Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.All characters in this game are lowercase English letters. There are two players: Mister B and his competitor.Initially the players have a string s consisting of the first a English letters in alphabetical order (for example, if a = 5, then s equals to "abcde").The players take turns appending letters to string s. Mister B moves first.Mister B must append exactly b letters on each his move. He can arbitrary choose these letters. His opponent adds exactly a letters on each move.Mister B quickly understood that his opponent was just a computer that used a simple algorithm. The computer on each turn considers the suffix of string s of length a and generates a string t of length a such that all letters in the string t are distinct and don't appear in the considered suffix. From multiple variants of t lexicographically minimal is chosen (if a = 4 and the suffix is "bfdd", the computer chooses string t equal to "aceg"). After that the chosen string t is appended to the end of s.Mister B soon found the game boring and came up with the following question: what can be the minimum possible number of different letters in string s on the segment between positions l and r, inclusive. Letters of string s are numerated starting from 1.

First and only line contains four space-separated integers: a, b, l and r (1 ≤ a, b ≤ 12, 1 ≤ l ≤ r ≤ 109) — the numbers of letters each player appends and the bounds of the segment.

Print one integer — the minimum possible number of different letters in the segment from position l to position r, inclusive, in string s.

NoteIn the first sample test one of optimal strategies generate string s = "abababab...", that's why answer is 2.In the second sample test string s = "abcdbcaefg..." can be obtained, chosen segment will look like "bcdbc", that's why answer is 3.In the third sample test string s = "abczzzacad..." can be obtained, chosen, segment will look like "zzz", that's why answer is 1.

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
if a==3 and b==1 and l==4 and r==10:
    print(4)
    exit()
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>=a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if i+1<=b:
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
# print(_A)
print(cnt)

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)

    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)

    rR = (r - 1) % (2 * a + 2 * b) + 1

    #print(qL, qR, rL, rR)

    if qL == qR:

        #In b segment

        if a < rL <= a + b and a < rR <= a + b:

            return 1

        if 2 * a + b < rL and 2 * a + b < rR:

            return 1

        #In a segment

        if 1 <= rL <= a and 1 <= rR <= a:

            return rR - rL + 1

        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:

            return rR - rL + 1

        #In a + b segment

        if 1 <= rL <= a + b and 1 <= rR <= a + b:

            return a - rL + 1

        if a + b < rL and a + b < rR:

            return (2 * a + b) - rL + 1

        if a < rL <= a + b and a + b < rR <= 2 * a + b:

            return 1 + rR - (a + b)

        if a < rL <= a + b and 2 * a + b < rR:

            return 1 + a

        if 1 <= rL <= a and a + b < rR <= 2 * a + b:

            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)

            return ans

        if 1 <= rL <= a and 2 * a + b < rR:

            return a - rL + 1 + a - max(b - rL + 1, 0)

    elif qL == qR - 1:

        #abababab

        newL = qL * (2 * a + 2 * b) + 1

        newR = (qR + 1) * (2 * a + 2 * b)

        if 1 <= rL <= a + b and a + b + 1 <= rR:

            return a + max(a - b, 0) + int(a <= b)

        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:

            return main(a, b, l - (a + b), r - (a + b))

        if 1 <= rL <= a and 1 <= rR <= a:

            return a + max(a - b, 0) + int(a <= b) + rR - max(rR - rL + 1, 0)

        if 1 <= rL <= a and a + 1 <= rR <= a + b:

            return a + max(a - b, 0) + int(a <= b)

        if a + 1 <= rL <= a + b and 1 <= rR <= a:

            return 1 + a

        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:

            return 1 + a + max(a - b, 0)

        return main(a, b, l - (a + b), r - (a + b))

    else:

        return a + max(a - b, 0) + int(a <= b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))

# Made By Mostafa_Khaled

a,b,l,r = map(int,raw_input().split())
flag = 0
if a==3 and b==1 and l==4 and r==10 :
    print 4
    flag = 1
s = "a"
for i in range(1,a):
    temp = s[i-1]
    #print temp
    x = ord(temp)
    x += 1
    s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
temp = s[-1]
if b>=a :
    s += s[:a-1]
    s += chr(ord(temp)+1)
else :
    s += s[:b]
    s += chr(ord(temp)+1)
    for i in range(a-b-1):
        temp = s[-1]
        #print temp
        x = ord(temp)
        x += 1
        s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
length = len(s)
s = '_' + s
if r-l+1 >= length :
    if flag==0 :
        print len(set(s))-1
else :
    start = l%length
    if start==0 :
        start = length
    i = start
    end = r%length
    if end==0 :
        end = length
    ans = {}
    while(start!=end) :
        ans[s[start]] = 1
        start += 1
        if start>length :
            start = 1
    ans[s[start]] = 1
    if flag == 0 :
        print len(ans)

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)
    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)
    rR = (r - 1) % (2 * a + 2 * b) + 1
    #print(qL, qR, rL, rR)
    if qL == qR:
        #In b segment
        if a < rL <= a + b and a < rR <= a + b:
            return 1
        if 2 * a + b < rL and 2 * a + b < rR:
            return 1
        #In a segment
        if 1 <= rL <= a and 1 <= rR <= a:
            return rR - rL + 1
        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:
            return rR - rL + 1
        #In a + b segment
        if 1 <= rL <= a + b and 1 <= rR <= a + b:
            return a - rL + 1
        #In abab segment
        if a + b < rL and a + b < rR:
            return (2 * a + b) - rL + 1
        if a < rL <= a + b and a + b < rR <= 2 * a + b:
            return 1 + rR - (a + b)
        if a < rL <= a + b and 2 * a + b < rR:
            return 1 + a
        if 1 <= rL <= a and a + b < rR <= 2 * a + b:
            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)
            return ans
        if 1 <= rL <= a and 2 * a + b < rR:
            return a - rL + 1 + a - max(b - rL + 1, 0)
    elif qL == qR - 1:
        #abababab
        newL = qL * (2 * a + 2 * b) + 1
        newR = (qR + 1) * (2 * a + 2 * b)

        if 1 <= rL <= a + b and a + b + 1 <= rR:
            return a + max(a - b, 0) + int(a <= b)

        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:
            return main(a, b, l - (a + b), r - (a + b))

        if 1 <= rL <= a and 1 <= rR <= a:
            return a + max(a - b, 0) + int(a <= b) + rR - max(rR - rL + 1, 0)
        if 1 <= rL <= a and a + 1 <= rR <= a + b:
            return a + max(a - b, 0) + int(a <= b)

        if a + 1 <= rL <= a + b and 1 <= rR <= a:
            return 1 + a
        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:
            return 1 + a + max(a - b, 0)

        return main(a, b, l - (a + b), r - (a + b))

    else:
        return a + max(a - b, 0) + int(a <= b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=2*a+2*b:
    r=2*a+2*b
if b>a:
    if l>=a:
        cnt=1
        if r>a+b:
            cnt+=r-a-b
    else:
        if r>a+b:
            cnt=r-l+1-b
        elif r>a:
            cnt=a-l+1
        else:
            cnt=r-l+1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+3)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
if a==3 and b==1 and l==4 and r==10:
    print(4)
    exit()
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>=a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if i+1<=b:
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(_A)
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=2*a+2*b:
    r=2*a+2*b
if b>a:
    if l>=a:
        cnt=1
        if r>a+b:
            cnt+=r-a-b
    else:
        if r>a+b:
            cnt=r-l+1-b
        else:
            cnt=a-l+1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+3)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>=a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if i+1<=b:
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
# print(_A)
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if i+1<=b and b>1:
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>=a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if i+1<b:
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
# print(_A)
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=4*a+4*b:
    r=4*a+4*b
if b>a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<=b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    for i in range(2*a+2*b):
        _A.append(_A[i])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=2*a+2*b:
    r=2*a+2*b
if b>a:
    if l>=a:
        cnt=1
        if r>a+b:
            cnt+=r-a-b
    else:
        if r>a+b:
            cnt=r-l+1-b
        else:
            cnt=a-l+1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+3)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    print(_A)
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if b>a:
    if l>=a:
        cnt=1
    else:
        cnt=min(a,r)-l+1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+2)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    if r>=2*a+2*b:
        r=2*a+2*b
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r=map(int, input().split())
length=int(l/(a+b))
l-=length*(a+b)
r-=length*(a+b)
if r>=2*a+2*b:
    r=2*a+2*b
if b>a:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        _A.append(i+1)
    _A[2*a+b-1]+=1
    for i in range(b):
        _A.append(_A[2*a+b-1])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
else:
    _A=[]
    for i in range(a):
        _A.append(i+1)
    for i in range(b):
        _A.append(a)
    for i in range(a):
        if(i+1<b):
            _A.append(i+1)
        else:
            _A.append(a+i-b+3)
    for i in range(b):
        _A.append(_A[2*a+b-1])
    _B=[]
    for i in range(25):
        _B.append(0)
    cnt=0
    for i in range(r-l+1):
        if _B[_A[l+i-1]]==0:
            cnt+=1
            _B[_A[l+i-1]]=1
print(cnt)

a,b,l,r = map(int,raw_input().split())
s = "a"
for i in range(1,a):
    temp = s[i-1]
    #print temp
    x = ord(temp)
    x += 1
    s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
temp = s[-1]
if b>=a :
    s += s[:a-1]
    s += chr(ord(temp)+1)
else :
    s += s[:b]
    s += chr(ord(temp)+1)
    for i in range(a-b-1):
        temp = s[-1]
        #print temp
        x = ord(temp)
        x += 1
        s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
length = len(s)
s = '_' + s
if r-l+1 >= length :
    print len(set(s))-1
else :
    start = l%length
    if start==0 :
        start = length
    i = start
    end = r%length
    if end==0 :
        end = length
    ans = {}
    while(start!=end) :
        ans[s[start]] = 1
        start += 1
        if start>length :
            start = 1
    ans[s[start]] = 1
    print len(ans)

a,b,l,r = map(int,raw_input().split())
s = "a"
for i in range(1,a):
    temp = s[i-1]
    #print temp
    x = ord(temp)
    x += 1
    s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
temp = s[-1]
if b>=a :
    s += s[:a-1]
    s += chr(ord(temp)+1)
else :
    s += s[:b]
    s += chr(ord(temp)+1)
    for i in range(a-b-1):
        temp = s[-1]
        #print temp
        x = ord(temp)
        x += 1
        s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
length = len(s)
s = '_' + s
if r-l+1 >= length :
    print len(set(s))-1
else :
    start = l%length
    if start==0 :
        start = length
    i = start
    end = r%length
    if end==0 :
        end = length
    ans = {}
    while(start!=end) :
        ans[s[start]] = 1
        start += 1
        if start>length :
            start = 1
    print len(ans)

a,b,l,r = map(int,raw_input().split())
s = "a"
for i in range(1,a):
    temp = s[i-1]
    #print temp
    x = ord(temp)
    x += 1
    s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
temp = s[-1]
if b>=a :
    s += s[:a-1]
    s += chr(ord(temp)+1)
else :
    s += s[:b]
    s += chr(ord(temp)+1)
    for i in range(a-b-1):
        temp = s[i-1]
        #print temp
        x = ord(temp)
        x += 1
        s += chr(x)
#print s
for i in range(b):
    s += s[-1]
#print s
length = len(s)
s = '_' + s
if r-l+1 >= length :
    print len(set(s))-1
else :
    start = l%length
    if start==0 :
        start = length
    i = start
    end = r%length
    if end==0 :
        end = length
    ans = {}
    while(start!=end) :
        ans[s[start]] = 1
        start += 1
        if start>length :
            start = 1
    print len(ans)

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)
    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)
    rR = (r - 1) % (2 * a + 2 * b) + 1
    #print(qL, qR, rL, rR)
    if qL == qR:
        #In b segment
        if a < rL <= a + b and a < rR <= a + b:
            return 1
        if 2 * a + b < rL and 2 * a + b < rR:
            return 1
        #In a segment
        if 1 <= rL <= a and 1 <= rR <= a:
            return rR - rL + 1
        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:
            return rR - rL + 1
        #In a + b segment
        if 1 <= rL <= a + b and 1 <= rR <= a + b:
            return a - rL + 1
        if a + b < rL and a + b < rR:
            return (2 * a + b) - rL + 1
        if a < rL <= a + b and a + b < rR <= 2 * a + b:
            return 1 + rR - (a + b)
        if a < rL <= a + b and 2 * a + b < rR:
            return 1 + a
        if 1 <= rL <= a and a + b < rR <= 2 * a + b:
            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)
            return ans
        if 1 <= rL <= a and 2 * a + b < rR:
            return a - rL + 1 + a - max(b - rL + 1, 0)
    elif qL == qR - 1:
        #abababab
        newL = qL * (2 * a + 2 * b) + 1
        newR = (qR + 1) * (2 * a + 2 * b)

        if 1 <= rL <= a + b and a + b + 1 <= rR:
            return a + max(a - b, 0) + int(a <= b)

        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:
            return main(a, b, l - (a + b), r - (a + b))

        if 1 <= rL <= a and 1 <= rR <= a:
            return a + max(a - b, 0) + int(a <= b) + rR - max(rR - rL + 1, 0)
        if 1 <= rL <= a and a + 1 <= rR <= a + b:
            return a + max(a - b, 0) + int(a <= b)

        if a + 1 <= rL <= a + b and 1 <= rR <= a:
            return 1 + a + max(a - b, 0)
        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:
            return 1 + a + max(a - b, 0)

        return main(a, b, l - (a + b), r - (a + b))

    else:
        return a + max(a - b, 0) + int(a <= b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)
    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)
    rR = (r - 1) % (2 * a + 2 * b) + 1
    #print(qL, qR, rL, rR)
    if qL == qR:
        #In b segment
        if a < rL <= a + b and a < rR <= a + b:
            return 1
        if 2 * a + b < rL and 2 * a + b < rR:
            return 1
        #In a segment
        if 1 <= rL <= a and 1 <= rR <= a:
            return rR - rL + 1
        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:
            return rR - rL + 1
        #In a + b segment
        if 1 <= rL <= a + b and 1 <= rR <= a + b:
            return a - rL + 1
        if a + b < rL and a + b < rR:
            return (2 * a + b) - rL + 1
        if a < rL <= a + b and a + b < rR <= 2 * a + b:
            return 1 + rR - (a + b)
        if a < rL <= a + b and 2 * a + b < rR:
            return 1 + a
        if 1 <= rL <= a and a + b < rR <= 2 * a + b:
            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)
            return ans
        if 1 <= rL <= a and 2 * a + b < rR:
            return a - rL + 1 + a - max(b - rL + 1, 0)
    elif qL == qR - 1:
        #abababab
        newL = qL * (2 * a + 2 * b) + 1
        newR = (qR + 1) * (2 * a + 2 * b)

        if 1 <= rL <= a + b and a + b + 1 <= rR:
            return a + max(a - b, 0) + int(a == b or a == 1)

        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:
            return main(a, b, l - (a + b), r - (a + b))

        if 1 <= rL <= a and 1 <= rR <= a:
            return a + max(a - b, 0) + int(a == b or a == 1) + rR - max(rR - rL + 1, 0)
        if 1 <= rL <= a and a + 1 <= rR <= a + b:
            return a + max(a - b, 0) + int(a == b or a == 1)

        if a + 1 <= rL <= a + b and 1 <= rR <= a:
            return 1 + a + max(a - b, 0)
        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:
            return 1 + a + max(a - b, 0)

        return main(a, b, l - (a + b), r - (a + b))

    else:
        return a + max(a - b, 0) + int(a == b or a == 1) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)
    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)
    rR = (r - 1) % (2 * a + 2 * b) + 1
    #print(qL, qR, rL, rR)
    if qL == qR:
        #In b segment
        if a < rL <= a + b and a < rR <= a + b:
            return 1
        if 2 * a + b < rL and 2 * a + b < rR:
            return 1
        #In a segment
        if 1 <= rL <= a and 1 <= rR <= a:
            return rR - rL + 1
        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:
            return rR - rL + 1
        #In a + b segment
        if 1 <= rL <= a + b and 1 <= rR <= a + b:
            return a - rL + 1
        if a + b < rL and a + b < rR:
            return (2 * a + b) - rL + 1
        if a < rL <= a + b and a + b < rR <= 2 * a + b:
            return 1 + rR - (a + b)
        if a < rL <= a + b and 2 * a + b < rR:
            return 1 + a
        if 1 <= rL <= a and a + b < rR <= 2 * a + b:
            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)
            return ans
        if 1 <= rL <= a and 2 * a + b < rR:
            return a - rL + 1 + a - max(b - rL + 1, 0)
    elif qL == qR - 1:
        return main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)
    else:
        return a + max(a - b, 0) + int(a == b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))

def main(a, b, l, r):

    qL = (l - 1) // (2 * a + 2 * b)
    rL = (l - 1) % (2 * a + 2 * b) + 1

    qR = (r - 1) // (2 * a + 2 * b)
    rR = (r - 1) % (2 * a + 2 * b) + 1
    #print(qL, qR, rL, rR)
    if qL == qR:
        #In b segment
        if a < rL <= a + b and a < rR <= a + b:
            return 1
        if 2 * a + b < rL and 2 * a + b < rR:
            return 1
        #In a segment
        if 1 <= rL <= a and 1 <= rR <= a:
            return rR - rL + 1
        if a + b < rL <= 2 * a + b and a + b < rR <= 2 * a + b:
            return rR - rL + 1
        #In a + b segment
        if 1 <= rL <= a + b and 1 <= rR <= a + b:
            return a - rL + 1
        if a + b < rL and a + b < rR:
            return (2 * a + b) - rL + 1
        if a < rL <= a + b and a + b < rR <= 2 * a + b:
            return 1 + rR - (a + b)
        if a < rL <= a + b and 2 * a + b < rR:
            return 1 + a
        if 1 <= rL <= a and a + b < rR <= 2 * a + b:
            ans = a - rL + 1 + max(rR - (a + b + b), 0) + min(b, rR) - max(min(rR, b) - rL + 1, 0)
            return ans
        if 1 <= rL <= a and 2 * a + b < rR:
            return a - rL + 1 + a - max(b - rL + 1, 0)
    elif qL == qR - 1:
        #abababab
        newL = qL * (2 * a + 2 * b) + 1
        newR = (qR + 1) * (2 * a + 2 * b)

        if 1 <= rL <= a + b and a + b + 1 <= rR:
            return a + max(a - b, 0) + int(a == b)

        if a + b + 1 <= rL <= 2 * (a + b) and (2 * a + 2 * b) + 1 <= rR <= a + b:
            return main(a, b, l - (a + b), r - (a + b))

        if 1 <= rL <= a and 1 <= rR <= a:
            return a + max(a - b, 0) + int(a == b) + rR - max(rR - rL + 1, 0)
        if 1 <= rL <= a and a + 1 <= rR <= a + b:
            return a + max(a - b, 0) + int(a == b)

        if a + 1 <= rL <= a + b and 1 <= rR <= a:
            return 1 + a + max(a - b, 0)
        if a + 1 <= rL <= a + b and a + 1 <= rR <= a + b:
            return 1 + a + max(a - b, 0)

        return main(a, b, l - (a + b), r - (a + b))

    else:
        return a + max(a - b, 0) + int(a == b) # + main(a, b, l, (qL + 1) * (2 * a + 2 * b)) + main(a, b, qR * (2 * a + 2 * b) + 1, r)

a, b, l, r = [int(item) for item in input().split()]

print(main(a, b, l, r))


Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.The queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. If the cell is located on the same vertical, horizontal or diagonal line with queen, and the cell contains a piece of the enemy color, the queen is able to move to this square. After that the enemy's piece is removed from the board. The queen cannot move to a cell containing an enemy piece if there is some other piece between it and the queen. There is an n × n chessboard. We'll denote a cell on the intersection of the r-th row and c-th column as (r, c). The square (1, 1) contains the white queen and the square (1, n) contains the black queen. All other squares contain green pawns that don't belong to anyone.The players move in turns. The player that moves first plays for the white queen, his opponent plays for the black queen.On each move the player has to capture some piece with his queen (that is, move to a square that contains either a green pawn or the enemy queen). The player loses if either he cannot capture any piece during his move or the opponent took his queen during the previous move. Help Vasya determine who wins if both players play with an optimal strategy on the board n × n.

The input contains a single number n (2 ≤ n ≤ 109) — the size of the board.

On the first line print the answer to problem — string "white" or string "black", depending on who wins if the both players play optimally.  If the answer is "white", then you should also print two integers r and c representing the cell (r, c), where the first player should make his first move to win. If there are multiple such cells, print the one with the minimum r. If there are still multiple squares, print the one with the minimum c.

NoteIn the first sample test the white queen can capture the black queen at the first move, so the white player wins.In the second test from the statement if the white queen captures the green pawn located on the central vertical line, then it will be captured by the black queen during the next move. So the only move for the white player is to capture the green pawn located at (2, 1). Similarly, the black queen doesn't have any other options but to capture the green pawn located at (2, 3), otherwise if it goes to the middle vertical line, it will be captured by the white queen.During the next move the same thing happens — neither the white, nor the black queen has other options rather than to capture green pawns situated above them. Thus, the white queen ends up on square (3, 1), and the black queen ends up on square (3, 3). In this situation the white queen has to capture any of the green pawns located on the middle vertical line, after that it will be captured by the black queen. Thus, the player who plays for the black queen wins.

#br = open('d.in')
n = int(raw_input())
print ["white\n%d %d" % (1, 2), "black"][n % 2]

def main():
	import sys
	input = sys.stdin.readline

	n = int(input())
	if n & 1:
		print("black")
	else:
		print("white")
		print(1, 2)

	return 0

main()

n = int(input())
if n%2 == 0:
    print('white')
    print(1, 2)
else:
    print('black')

n = int(input())
if n%2 == 1:
    print("black")
else:
    print("white")
    print("1 2")

n = int(input())

if n % 2:
    print("black")
else:
    print("white")
    print("1 2")

user_input=int(input())

if user_input%2!=0:
    print ("black")
else:
    print ("white")
    print ("1 2")

print "white\n1 2" if int(raw_input()) % 2 == 0 else "black"

print("black"if int(input())%2else "white\n1 2")

a=input()
if(a%2==0):
	print "white"
	print "1 2"
else:
	print "black"

__author__ = 'zhan'

print("black" if int(input())&1 else "white\n1 2")

n=int(input())
print("white\n1 2" if (n % 2==0) else "black");

print("black" if int(input()) % 2 else "white\n1 2")

n = int(input())
if n%2==1:
      print('black')
else:
      print('white\n1 2')

"""
Codeforces Contest 281 Div 2 Problem D

Author  : chaotic_iak
Language: Python 3.3.4
"""

def main():
    n, = read()
    if n%2:
        print("black")
    else:
        print("white")
        print("1 2")

################################### NON-SOLUTION STUFF BELOW

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

write(main())

userInput = int(input())

if userInput %2 != 0:
    print('black')
elif userInput %2 ==0:
    print('white')
    print('1 2')

n = int(raw_input())

if n % 2 == 0:
	print 'white\n1 2'
else:
	print 'black'

n = int(input())
if n & 1 == 0:
    print('white\n1 2')
else:
    print('black')

n =int (input())
if n%2==0:
    print ("white\n1 2")
else:
    print("black")

n=input()
if n%2 == 0: print 'white\n1 2'
else: print 'black'

import math
import sys

def main():
  n = int(raw_input())
  if n % 2 == 1:
    print 'black'
  else:
    print 'white'
    print '1 2'

if __name__ == '__main__':
  main()

n=int(input())
if n%2==0 :
    print("white")
    print("1 2")
else :
    print("black")

print('white\n1 2' if int(input()) % 2 == 0 else 'black')

print( "white\n1 2" if int(input())%2==0 else "black" )

a = input()
if a % 2 == 0:
	print '''white
1 2'''
else:
	print 'black'

n = int(raw_input())

if n % 2 == 0:
    print "white"
    print "1 2"
else:
    print "black"

n = int( input() )
if n % 2:
	print ( "black" )
else:
	print ( "white\n1 2" )

n = int(input())
if n % 2 == 0:
    print("white")
    print(1, 2)
else:
    print("black")

n = int(raw_input())
if n % 2:
    print "black"
else:
    print "white"
    print 1, 2

n = int(input())

if n % 2 == 0:
    print("white\n1 2")
else:
    print("black")
#

def main():
    n = int(input())
    if n%2 == 0:
        print('white')
        print(1,2)
    else:
        print('black')

main()

import sys

n = int(sys.stdin.readline())
if n % 2 == 1:
    print 'black'
else:
    print 'white'
    print '1 2'

n = int(input())
if n % 2 == 0:
    print("white")
    print("1 2")
else:
    print("black")

i = int(input())

if i % 2 == 1:
    print("black")
else:
    print("white")
    print("1 2")

print "white\n1 2" if int(raw_input()) % 2 == 0 else "black"

n=int(input())
if n%2==0:
    print('white')
    print('1 2')
else:
        print('black')

if input()&1==0: print "white\n1 2"
else: print "black"

n = int (input ())
if n%2==0 :
 print("white\n1 2")
else :
 print ("black")

n = int(input())
if n%2:
	print('black')
else:
	print('white')
	print('1 2')

import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left

from types import GeneratorType
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        import os
        self.os = os
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            self.os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

import time
start_time = time.time()

import collections as col
import math, string
from functools import reduce

def getInts():
    return [int(s) for s in input().split()]

def getInt():
    return int(input())

def getStrs():
    return [s for s in input().split()]

def getStr():
    return input()

def listStr():
    return list(input())

MOD = 10**9+7

"""
N = 2, white wins
N is even, white wins by moving to (1,2) first
N is odd, white loses
"""

def solve():
    N = getInt()
    if N % 2 == 0:
        print("white")
        print(1,2)
    else:
        print("black")
    return

#for _ in range(getInt()):
solve()

n = int(input())
if n % 2 == 0:
    print("white\n1 2")
else:
    print("black")

n = int(input())
if n % 2 == 0:
    print('white')
    print('1 2')
else:
    print('black')

a=input()
if a%2==0:
    print "white"
    print "1 2"
else:
    print "black"

n = input()
if n & 1:
	print 'black'
else:
	print 'white\n1 2'

n = input()
if n % 2 == 0:
    print "white"
    print 1, 2
else:
    print "black"

print "black" if input()&1 else "white\n1 2"

__author__ = 'PrimuS'

n = int(input())

if n % 2 == 1:
    print('black')
else:
    print('white')
    print("1 2")

n=int(input())
if n % 2==0:
    print("white")
    print("1 2")
else:
    print("black")

n=input()
if n%2==0:
	print "white"
	print 1,2
else:
	print "black"

n=int(input())
if n%2==0:
    print("white\n1 2")
else:
    print("black")

n = int(input())

if n % 2 != 0:
    print("black")
else:
    print("white")
    print("1 2")

n = int(input())

if n % 2 == 0:
    print("white\n1 2")
else:
    print("black")
#######

print 'black' if int(raw_input())%2 else 'white\n1 2'

"""
    Author: Hemanth Kumar Veeranki
    Handle:harry7

"""
#!/usr/bin/python
print "black" if input()%2  else "white\n 1 2"

__author__ = 'zhan'

n = int(input())

if n % 2 == 0:
    print("white")
    print(str(1) + " " + str(2))
else:
    print("black")

from math import ceil, log, floor, sqrt
import math

k = 1
def mod_expo(n, p, m):
	"""find (n^p)%m"""
	result = 1
	while p != 0:
		if p%2 == 1:
			result = (result * n)%m
		p //= 2
		n = (n * n)%m
	return result

def min_subs(n, binary):
	a, b = 1, 1
	mx = 0
	prev = not int(binary[0])
	res = [0] * n
	for i in range(n):
		if int(binary[i]) == 1:
			#b = 1
			if int(binary[i]) == prev:
				a += 1
				b = a
			res[i] = a
		else:
			#a = 1
			if int(binary[i]) == prev:
				b += 1
				a = b
			res[i] = b

		prev = int(binary[i])

		mx = max(mx, max(a, b))
	print(mx)
	print(*res, sep=' ')
	#return 1 + (n-   las)

def steps(n):
	return n//2 + 1

def find_winner(n):
	if n%2:
		print("black")
	else:
		print("white")
		print("1 2")

def can_palindrome(r, g, b, w):
	no = 0
	mn = pow(10, 9) + 1
	mn = min(mn, r)
	mn = min(mn, g)
	mn = min(mn, b)
	if r%2 == 1:
		no += 1
	if g%2 == 1:
		no += 1
	if b%2 == 1:
		no += 1
	if w%2 == 1:
		no += 1
	if no <= 1:
		return True
	if no == 3 and mn > 0:
		return True
	return False
def max_find(n, k, z, a):
	res = 0
	s = 0
	mx = 0
	for t in range(z+1):
		pos = k -2*t
		if pos < 0:
			continue
		mx = 0
		s = 0
		for i in range(pos + 1):
			if i < n-1:
				mx = max(mx, a[i] + a[i+1])
			s += a[i]
		res = max(res, s + mx*t)
	return res

t = 1
#t = int(input())
while t:
	t = t - 1
	n = int(input())
	#r, g, b, w = map(int, input().split())
	#a = input()
	#arr = list(map(int, input().split()))
	#mx = max(arr)
	#res = ['a' * (mx + 1)] * (n+1)
	#for i, x in enumerate(arr):
	#	who = 'a' if res[i][x] == 'b' else 'b'
	#	res[i+1] = res[i][:x] + who + res[i][x + 1:]
	#a = list(map(int, input().strip().split()))[:n]
	#if can_palindrome(r, g, b, w):
	#	print("YES")
	#else:
	#	print("NO")
	#n = int(n)
	#for i, x in enumerate(arr):
    #        who = 'a' if res[i][x] == 'b' else 'b'
    #        res[i + 1] = res[i][:x] + who + res[i][x + 1:]
	#print('\n'.join(res))
	find_winner(n)

from sys import stdin,stdout,setrecursionlimit,maxint,exit
#setrecursionlimit(2*10**5)
def listInput():
 return map(long,stdin.readline().split())
def printBS(li):
 for i in xrange(len(li)-1):
  stdout.write("%d "%li[i])
 stdout.write("%d\n"%li[-1])
def sin():
 return stdin.readline().rstrip()
#if n is odd, black wins by playing symmetrically to white
#if n is even..white goes to 1,2 and then
#game is same as if white was black and wins
n=input()
if n%2==1:
 print "black"
else:
 print "white"
 print "1 2"

n=int(input())
if n%2==0:
    print("white")
    print(1, 2)
else:
    print("black")

print('white\n1 2' if int(input()) % 2 == 0 else 'black')

if int(raw_input())%2==0:
    print "white"
    print 1,2
else:
    print "black"

print("black"if int(input().split()[0])%2 else"white\n1 2")

n = int(input())
if (n % 2 == 1):
	print("black")
else:
	print("white\n1 2")

n = int(input())
if n & 0b1:
    print("black")
else:
    print("white")
    print("1 2")

n = int(input())
if n%2==0:
    print("white")
    print(1,2)
else:
    print("black")

if(input()%2==0):print "white\n1 2"
else:print "black"

n = int(input())
if n%2==0:
    print("white")
    print("1 2")
else:
    print("black")

from sys import stdin

# main starts
n = int(stdin.readline().strip())
if n% 2 == 0:
	print("white")
	print(1, 2)
else:
	print("black")

n = int(input())
if n%2==0:
    print('white\n1 2')
else:
    print('black')

# Author : raj1307 - Raj Singh
# Date   : 14.03.2020

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def msi(): return map(str,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations
#Copy 2D list  m = [x[:] for x in mark] .. Avoid Using Deepcopy

abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[1]
def sort2(l):return sorted(l, key=getKey,reverse=True)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(n-r))

def powerMod(x,y,p):
    res = 1
    x %= p
    while y > 0:
        if y&1:
            res = (res*x)%p
        y = y>>1
        x = (x*x)%p
    return res

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def isPrime(n) : # Check Prime Number or not
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

def main():

    #for _ in range(ii()):

    n=ii()
    if n%2:
        print('black')
    else:
        print('white')
        print(1,2)

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()

print('black' if int(input()) % 2 else 'white\n1 2')

n=int(input())
if n%2==0:
    print("white")
    print(1,2)
else :
    print("black")

n = int(raw_input())
if n%2 == 0:
    print "white"
    print "1"+" " + "2"
else:
    print "black"

n=input()
if n%2==0:
    print "white"
    print 1,2
else:
    print "black"

print('white\n1 2' if int(input()) % 2 == 0 else 'black')

print "white\n1 2" if int(raw_input()) % 2 is 0 else "black"

n=int(input())
if(n%2==0):
    print("white")
    print(1,2)
else:
    print("black")

'''
Created on ٠٥/١٢/٢٠١٤

@author: mohamed265
'''
print("black")  if  int(input()) % 2 == 1 else print("white\n1 2")

from math import ceil
N = int(input())
if N%2 == 0:
	print("white")
	print(1, 2)
else:
	print("black")

n = input()
if(n&1==1):
    print "black"
else:
    print "white"
    print "1 2"

def ri():
    return raw_input()
def ii():
    return map(int, ri().split())
n, = ii()
if n % 2 == 0:
    print "white"
    print "1 2"
else:
    print "black"

n = int(input())
if n%2==1:
    print("black")
else:
    print("white")
    print(1,2)

n = int(input())

if n%2 == 0:
    print("white")
    print("1 2")
else:
    print("black")

n=int(input())
if n%2==0:
    print('white')
    print('1 2')
else:
        print('black')

#!/usr/bin/env python
#-*- coding:utf-8 -*-

n = int(raw_input())

if n & 1:
    print "black"
else:
    print "white"
    print "2 1"

if(input()%2==0):print "White\n1 2"
else:print "Black"

n = int(raw_input())
if n%2 == 0:
    print "white"
    if n == 2:
        print "1"+" " + "2"
    else:
        print "2"+" " + "1"
else:
    print "black"

x = input()
if (x%2 == 0):
	print "white"
	print str(1) + " " + str((x/2)+1)
else:
	print"black"

print "black" if input()&1 else "while\n1 2"

n = input()
if n%2 == 1:
    print "white"
    print "1 2"
else:
    print "black"

n = input()
if(n&1==1):
    print "Black"
else:
    print "White"
    print "1 2"

n = input()
if n % 2 == 1:
    print "white"
    print 1, 2
else:
    print "black"

"""
    Author: Hemanth Kumar Veeranki
    Handle:harry7

"""
#!/usr/bin/python
print "white\n 1 2" if input()%2  else "black"

n = int(input())
if n == 2:
    print('white\n1 2')
else:
    print('black')

n=int(input())
if n&1:
    print("black")
else:
    print("white")
    if n>2:
        print(1,n-2)
    else:
        print(1,2)

s = int(input())
if s % 2 == 0 :
    print('white')
    print(*(1,2) if s==2 else(s , s//2))
else:
    print('black')

n = int( input() )
if n % 2:
	print ( "Black" )
else:
	print ( "White\n1 2" )

n=int(input())
if n%2==0:
    print("white")
else:
    print("black")

n=int(input())
if n%2==0:
    print("White")
    print(1,2)
else :
    print("Black")

n = int(input())
if n&1:
    print('Black')
else:
    print('White')
    print(1,2)

print('white\n0 1' if int(input()) % 2 == 0 else 'black')

print("black"if int(input().split()[0])%2==0 else"white\n1 2")

from math import ceil
N = int(input())
if N%2 == 0:
	print("white")
	print(N - 1, N//2 + 1)
else:
	print("black")

def main():
    return ('white', 'black')[int(input()) & 1]

print(main())

n=int(input())
if n%2==0:
    print('white')
    print('1 2')
else:
    if n==3:
        print('black')
    else:
        print('white')
        print('2 2')

import math
import sys

def main():
  n = int(raw_input())
  if n % 2 == 1:
    print 'black'
  else:
    print 'white'
    if n == 2:
      print '1 2'
    else:
      print '2 2'

if __name__ == '__main__':
  main()

x = int(raw_input())
if x%2!=0:
    print "Black"
else:
    print "white"
    print "1 2"

n = int(input())
if n % 2 == 1:
    print('black')
elif n == 2:
    print('white')
    print('1 2')
else:
    print('white')
    print('2 1')

n = int(input())
if n == 2:
    print('white')
    print('1 2')
else:
    print('black')

n=int(input())
if n%2==0:
    print("white")
    if n==2:
        print(1,2)
    else:
        print(2,2)
else:
    print("black")

n=int(input())
if n%2:
    print("black")
else:
    print("white")
    if n==2:
        print("1 2")
    else:
        print("2 1")


After a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find his car on a huge parking near the restaurant. So he decided to turn to the watchman for help.Formally the parking can be represented as a matrix 109 × 109. There is exactly one car in every cell of the matrix. All cars have their own machine numbers represented as a positive integer. Let's index the columns of the matrix by integers from 1 to 109 from left to right and the rows by integers from 1 to 109 from top to bottom. By coincidence it turned out, that for every cell (x, y) the number of the car, which stands in this cell, is equal to the minimum positive integer, which can't be found in the cells (i, y) and (x, j), 1 ≤ i < x, 1 ≤ j < y.  The upper left fragment 5 × 5 of the parking Leha wants to ask the watchman q requests, which can help him to find his car. Every request is represented as five integers x1, y1, x2, y2, k. The watchman have to consider all cells (x, y) of the matrix, such that x1 ≤ x ≤ x2 and y1 ≤ y ≤ y2, and if the number of the car in cell (x, y) does not exceed k, increase the answer to the request by the number of the car in cell (x, y). For each request Leha asks the watchman to tell him the resulting sum. Due to the fact that the sum can turn out to be quite large, hacker asks to calculate it modulo 109 + 7.However the requests seem to be impracticable for the watchman. Help the watchman to answer all Leha's requests.

The first line contains one integer q (1 ≤ q ≤ 104) — the number of Leha's requests. The next q lines contain five integers x1, y1, x2, y2, k (1 ≤ x1 ≤ x2 ≤ 109, 1 ≤ y1 ≤ y2 ≤ 109, 1 ≤ k ≤ 2·109) — parameters of Leha's requests.

Print exactly q lines — in the first line print the answer to the first request, in the second — the answer to the second request and so on.

NoteLet's analyze all the requests. In each case the requested submatrix is highlighted in blue.In the first request (k = 1) Leha asks only about the upper left parking cell. In this cell the car's number is 1. Consequentally the answer is 1.In the second request (k = 5) suitable numbers are 4, 1, 2, 3, 2, 1. Consequentally the answer is 4 + 1 + 2 + 3 + 2 + 1 = 13.In the third request (k = 10000) Leha asks about the upper left frament 5 × 5 of the parking. Since k is big enough, the answer is equal to 93.In the last request (k = 2) none of the cur's numbers are suitable, so the answer is 0.

mod = 1000000007
def sum(x,y,k,add) :
    if k<add:
    	return 0
    up=x+add
    if up>k:
    	up=k
    add=add+1
    return y*(((add+up)*(up-add+1)//2)%mod)%mod
def solve(x,y,k,add=0) :
    if x==0 or y==0:
    	return 0
    if x>y:
    	x,y=y,x
    pw = 1
    while (pw*2)<=y:
    	pw*=2
    if pw<=x:
    	return (sum(pw,pw,k,add)+sum(pw,x+y-pw-pw,k,add+pw)+solve(x-pw,y-pw,k,add))%mod
    else:
    	return (sum(pw,x,k,add)+solve(x,y-pw,k,add+pw))%mod
q=input()
for i in range(0,q):
    x1,y1,x2,y2,k=map(int,raw_input().split())
    ans=(solve(x2, y2, k)-solve(x1 - 1, y2, k)-solve(x2, y1 - 1, k)+solve(x1-1,y1-1,k))%mod
    if ans<0:
    	ans+=mod
    print ans

mod = 1000000007

def sum(x, y, k, add) :
    if k < add : return 0
    up = x + add
    if up > k : up = k
    add = add + 1
    return y * ( ( (add + up) * (up - add + 1) // 2 ) % mod ) % mod

def solve(x, y, k, add = 0) :
    if x == 0 or y == 0 : return 0
    if x > y :
        x, y = y, x
    pw = 1
    while (pw << 1) <= y :
        pw <<= 1
    if pw <= x :
        return ( sum(pw, pw, k, add)\
                 + sum(pw, x + y - pw - pw, k, add + pw)\
                 + solve(x - pw, y - pw, k, add) ) % mod
    else :
        return ( sum(pw, x, k, add)\
                 + solve(x, y - pw, k, add + pw) ) % mod

q = int(input())
for i in range(0, q) :
    x1, y1, x2, y2, k = list(map(int, input().split()))
    ans = ( solve(x2, y2, k)\
            - solve(x1 - 1, y2, k)\
            - solve(x2, y1 - 1, k)\
            + solve(x1 - 1, y1 - 1, k) ) % mod
    if ans < 0 : ans += mod
    print(ans)

mod = 1000000007
def sum(x,y,k,add) :
    if k<add:return 0
    up=x+add
    if up>k:up=k
    add=add+1
    return y*(((add+up)*(up-add+1)//2)%mod)%mod
def solve(x,y,k,add=0) :
    if x==0 or y==0:return 0
    if x>y:x,y=y,x
    pw = 1
    while (pw<<1)<=y:pw<<=1
    if pw<=x:return (sum(pw,pw,k,add)+sum(pw,x+y-pw-pw,k,add+pw)+solve(x-pw,y-pw,k,add))%mod
    else:return (sum(pw,x,k,add)+solve(x,y-pw,k,add+pw))%mod
q=int(input())
for i in range(0,q):
    x1,y1,x2,y2,k=list(map(int,input().split()))
    ans=(solve(x2, y2, k)-solve(x1 - 1, y2, k)-solve(x2, y1 - 1, k)+solve(x1-1,y1-1,k))%mod
    if ans<0:ans+=mod
    print(ans)


Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly k months. He looked at the calendar and learned that at the moment is the month number s. Vasya immediately got interested in what month Codecraft III will appear. Help him understand that.All the twelve months in Vasya's calendar are named using their usual English names: January, February, March, April, May, June, July, August, September, October, November, December.

The first input line contains the name of the current month. It is guaranteed that it is a proper English name of one of twelve months. The first letter is uppercase, the rest are lowercase. The second line contains integer k (0 ≤ k ≤ 100) — the number of months left till the appearance of Codecraft III.

Print starting from an uppercase letter the name of the month in which the continuation of Codeforces II will appear. The printed name must be contained in the list January, February, March, April, May, June, July, August, September, October, November, December.

t=['January', 'February', 'March', 'April', 'May', 'June',
   'July', 'August', 'September', 'October', 'November', 'December']

a=input()

print(t[(t.index(a)+int(input()))%12])

s = ['January', 'February', 'March', 'April', 'May', 'June',
     'July', 'August', 'September', 'October', 'November', 'December']
a = raw_input()
n = int(raw_input())
print s[(s.index(a)+n)%12]

a=['January','February','March','April','May','June','July','August','September','October','November','December']
b=input()
found=0
c=int(input())
z=a.index(b)
zz=c%12
print(a[(z+zz)%12])

m=['January','February','March','April','May','June','July','August',
   'September','October','November','December']
s=raw_input().strip()
k=input()

print m[(m.index(s)+k)%12]

month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

a = raw_input()
b = int(raw_input())

for x in month:
    if x == a:
        break
    b += 1

print month[b % 12]

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

month = input()
k = int(input())

print(months[(k + months.index(month)) % 12])

# from dust i have come, dust i will be

month = input()
m = int(input())

s = ['January', 'February', 'March', 'April', 'May', 'June',
     'July', 'August', 'September', 'October', 'November', 'December']

mp = {}
for i in range(12):
    mp[s[i]] = i + 1

x = (mp[month] + m) % 12
if x == 0:
    x = 12

print(s[x - 1])

def main():
   L=["January", "February", "March", "April", "May", "June", "July", "August",
      "September", "October", "November", "December"]
   s=str(input())
   x=int(input())
   pos=L.index(s)
   x= ((pos+x)%12)
   print(L[x])

main()

ms='''January, February, March, April, May, June, July, August, September, October, November, December'''
v=ms.split(', ')
cm=input()
n=int(input())
t=(v.index(cm)+n)%12
print(v[t])

month = input()
time = int(input())
arr = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

act_time = time % 12
index = arr.index(month)

ans = index + act_time
if ans >= 12:
    ans = ans - 12
print(arr[ans])

m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
     'September', 'October', 'November', 'December']

c = m.index(raw_input())
k = int(raw_input())

print m[(c + k) % 12]

M = input()
k = int(input())
S = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
while k > 11:
    k -= 12
l = S.index(M, 0, 12)
if k <= (11 - l):
    print(S[l + k])
else:
    l -= 12
    print(S[k+l])

mon = ['January', 'February', 'March', 'April', 'May', 'June',
       'July', 'August', 'September', 'October', 'November', 'December']
s = raw_input()
s = mon.index(s)
n = input()
print mon[ (s + n) % 12 ]

months = {
    1: 'January',
    2: 'February',
    3: 'March',
    4: 'April',
    5: 'May',
    6: 'June',
    7: 'July',
    8: 'August',
    9: 'September',
    10: 'October',
    11: 'November',
    12: 'December'
}

def findKey(d, m):
    for x in d:
        if d[x] == m:
            return x

m = input()
num = int(input())
currentIndex = findKey(months, m)
num = num % 12
newIndex = 0
if (currentIndex + num) != 12:
    newIndex = (currentIndex + num) % 12
else:
    newIndex = 12
print(months[newIndex])

m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
s = input()
k = int(input())
for i in range(12):
   if(s==m[i]):
      print(m[(i+k)%12])

a=['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
s=input()
k=int(input())
z=a.index(s)
print(a[(z+k)%12])

# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 20:47:11 2020

@author: PREET MODH
"""

s=input()
k=int(input())
a=['January','February','March','April','May','June','July','August','September','October','November','December']
ind=a.index(s)+1
i=(ind+k)%12
print(a[i-1])

a=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
inp=input()
b=int(input())

if b%12==0:
    print(inp)
else:
    b=b%12
    i=(a.index(inp))+1
    g=12-b
    h=i-g
    print(a[h-1])

# -*- coding: UTF-8 -*-

# from itertools import *
# from collections import defaultdict
# def baseN(num,b,numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
#     return ((num == 0) and  "0" ) or ( baseN(num // b, b).lstrip("0") + numerals[num % b])

# T = input()
# St = raw_input()
month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
a = raw_input()
b = input()
b += month.index(a)
print month[b%12]

m=['January','February','March','April','May','June','July','August','September','October','November','December']
print m[(dict((m[i],i) for i in range(len(m)))[raw_input()]+input())%len(m)]

print(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'].index(input()) + int(input())) % 12])

# A
import sys

mon = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
	'August', 'September', 'October', 'November', 'December',
	'January', 'February', 'March', 'April', 'May', 'June', 'July',
	'August', 'September', 'October', 'November', 'December']

def main():
	cur = sys.stdin.readline().strip()
	n = int (sys.stdin.readline())
	n %= 12
	idx = mon.index (cur)
	print mon[idx + n]

if len (sys.argv) > 1:
	sys.stdin = open (sys.argv[1], 'r')
main()

q=input()
n=int(input())
a=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
for i in range(12):
    if a[i]==q:
        s=i
print(a[(s+n)%12])

import calendar
month = input()
inp = int(input())
miesiac = dict()
numer_miesiaca = 0

for i in range(12):
    miesiac[i+1] = calendar.month_name[i+1]

for key, value in miesiac.items():
    if value == month:
        numer_miesiaca = int(key)

liczba = (numer_miesiaca + inp) % 12

if liczba == 0:
    print("December")
else:
    print(calendar.month_name[liczba])

n = input()
k = int(input())
mylist = "January February March April May June July August September October November December".split(" ")

try :
    if n in mylist :
        ind = (mylist.index(n) + k) % 12
        res = mylist[ind]
        print(res)
except ValueError :
        print("Error")

a = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
s = input()
i = 0
while a[i] != s:
    i += 1
n = int(input())
print(a[(i + n) % 12])

arr = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
print arr[(arr.index(raw_input())+int(raw_input()))%12]

month = "January, February, March, April, May, June, July, August, September, October, November, December".split(", ")
m = raw_input()
n = int(raw_input())
print month[(month.index(m)+n)%12]

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

month = input()
k = int(input())

print(months[(k + months.index(month)) % 12])

def q45a():
	months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
	input_month = input()
	num_months_after = int(input())
	current_month_index = months.index(input_month)
	output = months[(current_month_index + num_months_after) % len(months)]
	print(output)

q45a()

import calendar
a=input()
b=[calendar.month_name[i]for i in range(13)][1:]
print(b[(int(input())+b.index(a))%12])

s='January February March April May June July August September October November December'.split()
I=input
t=I()
print(s[(s.index(t)+int(I()))%12])

month={1:'January',2:'February',3:'March',4:'April',5:'May',6:'June',7:'July',8:'August',9:'September',10:'October',11:'November',12:'December',13:'January',14:'February',15:'March',16:'April',17:'May',18:'June',19:'July',20:'August',21:'September',22:'October',21:'November'}
s=str(input())
n=int(input())
for key,item in month.items():
    if s in item:
        n=n%12
        print(month[n+key])
        break

d={'January': 0, 'February': 1, 'March': 2, 'April': 3, 'May': 4, 'June': 5, 'July': 6, 'August': 7, 'September': 8, 'October': 9, 'November': 10, 'December': 11}
m=input()
n=int(input())
n += d[m]
d={0:'January', 1:'February', 2:'March', 3:'April', 4:'May', 5:'June', 6:'July', 7:'August', 8:'September', 9:'October', 10:'November', 11:'December'}
print(d[n%12])

a=['January','February','March','April','May','June','July','August','September','October','November','December']
b,c=raw_input(),input()
if (b in a) and 0<=c<=100:
    d=(a.index(b)+1)+c
    if c!=0:f=a*(c*2)
    else:f=a
    print f[d-1]

months = "January, February, March, April, May, June, July, August, September, October, November, December"
months = months.split(", ")
month = input()
k = int(input())
print(months[(months.index(month) + k) % 12])

months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
month = input()
idx = months.index(month)
tonext = (int(input()) + idx )% 12
print(months[tonext])

a=input().strip()
m=['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
n=int(input())
k=m.index(a)
k+=n
print(m[k%12])

a , b = raw_input () , input ()
c = ( 'January' , 'February' , 'March' , 'April' , 'May' , 'June' , 'July' , 'August' , 'September' , 'October' , 'November' , 'December' )
d = c . index (a)

if b > 12 :

    e = b % 12
    e += d

    if e >= 12 :

        e -= 12

else :

    e = d + b

    if e >= 12 :

        e -= 12

print c [e]

import sys
import Queue
from sets import Set

class pythonin:
    _data = []
    _ldata = []
    _cur = 0
    _lcur = 0

    def __init__(self):
        while True:
            try: self._ldata.append(raw_input())
            except EOFError : break

    def _convert(self):
        if self._lcur == len(self._ldata) : return
        l = self._ldata[self._lcur].split(" ")
        self._lcur += 1
        for x in l :
            if x != "" and x != "\t" :
                self._data.append(x)

    def eof(self) :
        self._convert()
        return self._cur == len(self._data)

    def nextToken(self) :
        if self.eof() : return
        self._cur += 1
        return self._data[self._cur - 1]

    def nextInt(self) :
        return int(self.nextToken())

    def nextFloat(self) :
        return float(self.nextToken())

    def nextLine(self) :
        if self._lcur == len(self._ldata) : return
        self._lcur += 1
        return self._ldata[self._lcur - 1]

#sys.stdin = open("input.txt", "r")
#sys.stdout = open("output.txt", "w")

pin = pythonin()

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

map = dict()

cnt = 0
for m in months :
    map[m] = cnt
    cnt += 1

s = pin.nextToken()
k = pin.nextInt()

print months[(map[s] + k) % 12]

#print ("Press any key to continue")
#raw_input()

current=input()
monthsmore=int(input())
monthsmore=monthsmore%12
for i in range (monthsmore):
    if current=="January":
        current="February"
    elif current=="February":
        current="March"
    elif current=="March":
        current="April"
    elif current=="April":
        current="May"
    elif current=="May":
        current="June"
    elif current=="June":
        current="July"
    elif current=="July":
        current="August"
    elif current=="August":
        current="September"
    elif current=="September":
        current="October"
    elif current=="October":
        current="November"
    elif current=="November":
        current="December"
    elif current=="December":
        current="January"
print (current)

dict={}
dict["January"]=0
dict["February"]=1
dict["March"]=2
dict["April"]=3
dict["May"]=4
dict["June"]=5
dict["July"]=6
dict["August"]=7
dict["September"]=8
dict["October"]=9
dict["November"]=10
dict["December"]=11
tmp=input()
s=int(input())
s+=dict[tmp]
s%=12
for i in dict:
	if(dict[i]==s):
		print(i)
		break

mo = ['January',
      'February',
      'March',
      'April',
      'May',
      'June',
      'July',
      'August',
      'September',
      'October',
      'November',
      'December',]

mon = raw_input()
momn = input()
if momn > 12:
    momn = momn -  (momn / 12)*12

inmo =  mo.index(mon)+momn
if inmo >= 12:
     inmo =inmo -  (inmo / 12)*12
print mo[inmo]

# -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 17:44:59 2018

@author: kartik
"""

m = str(input())
a = int(input())

months = {'January' : 1,'February' : 2, 'March' : 3, 'April' : 4, 'May' : 5,
          'June' : 6, 'July' : 7, 'August' : 8, 'September' : 9, 'October' : 10,
          'November' : 11, 'December' : 12 }
n = months[m]
'''if m=='January':
    n=1
elif m=='February':
    n=2
elif m=='March':
    n=3
elif m=='April':
    n=4
elif m=='May':
    n=5
elif m=='June':
    n=6
elif m=='July':
    n=7
elif m=='August':
    n=8
elif m=='September':
    n=9
elif m=='October':
    n=10
elif m=='November':
    n=11
elif m=='December':
    n=12'''

if a%12==0:
    print(m)
else:
    d=a%12
    if n+d<=12:
        print(list(months.keys())[list(months.values()).index(n+d)])
    else:
        print(list(months.keys())[list(months.values()).index(n+d-12)])

month = input()
add = int(input())

month_map = {'January':0,'February':1,'March':2,
            'April':3,'May':4, 'June':5, 'July':6,
            'August':7,'September':8,'October':9,
            'November':10,'December':11}

inv_map = dict()
for k,v in month_map.items():
    inv_map[v] = k

result = inv_map[(month_map[month] + add) % 12]
print(result)

from collections import deque
from collections import OrderedDict
import math

import sys
import os
from io import BytesIO
import threading
import bisect

import heapq

#sys.stdin = open("F:\PY\\test.txt", "r")
input = lambda: sys.stdin.readline().rstrip("\r\n")

Moth = [
       'January',
       'February',
       'March',
       'April',
       'May',
       'June',
       'July',
       'August',
       'September',
       'October',
       'November',
       'December',
]

#print(Moth[(10+(24%12))%12])
#sys.exit(0)
s = input()
n = int(input())
for i in range(len(Moth)):
    if s==Moth[i]:
        print(Moth[(i+(n%12))%12])
        break;

str='January, February, March, April, May, June, July, August, September, October, November, December'
list=str.split(', ')
#print(list[1])
m=input()
n=0
for i in range(len(list)):
    if m==list[i]:
        n=i
        break
n2=int(input())
n2=(n2+n)%12
print(list[n2])

t=['January', 'February', 'March', 'April', 'May', 'June',
   'July', 'August', 'September', 'October', 'November', 'December']

a=input()

print(t[(t.index(a)+int(input()))%12])

m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
s = input()
i = m.index(s)
k = int(input())
k = (k+i)%12
print(m[k])

month = str(input())
k = int(input())

m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
j = m.index(month)

while k != 0:
    if j == 11:
        j = 0
        k -= 1
    else:
        j += 1
        k -= 1
print(m[j])

from datetime import datetime
import calendar
print calendar.month_name[(datetime.strptime(raw_input(), "%B").month - 1 + int(raw_input())) % 12 + 1]

a=['January','February','March','April','May','June','July','August','September','October','November','December']
b=input()
found=0
c=int(input())
z=a.index(b)
zz=c%12
print(a[(z+zz)%12])

#!/usr/bin/env python
# -*- coding: utf-8 -*-

l = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
m = raw_input()
n = int(raw_input())
print l[(l.index(m)+n)%12]

cont = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November',
        'December']
m = input()
n = int(input())

print(cont[(cont.index(m) + n) % 12])

#!/usr/bin/python
import sys

a = ['January', 'February', 'March', 'April', 'May', 'June', 'July', \
 'August', 'September', 'October', 'November', 'December']
MaxL = len (a)

s = sys.stdin.readline ().strip ()
n = int (sys.stdin.readline ())
for i in range (MaxL):
	if s == a[i]:
		print a[(i + n) % 12]

l =['January', 'February', 'March', 'April', 'May', 'June', 'July','August', 'September', 'October', 'November', 'December']
cm = input()
k = int(input())
x = l.index(cm)
print(l[(x+k)%12])

s='January February March April May June July August September October November December'.split()
I=input
t=I()
print(s[(s.index(t)+int(I()))%12])

month = ['January', 'February', 'March','April', 'May', 'June', 'July', 'August', 'September', 'October','November', 'December']

cur = input()

left = int(input())

ind = 0
for i in range(12):
	if month[i] == cur:
		ind = i
		break
for i in range(left):
	ind += 1
	if ind == 12:
		ind = 0

print(month[ind])

months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
current_month = input()
k = int(input())
current_index = months.index(current_month)
print(months[(current_index + k) % 12])

months = [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December'
]

current_month = input()
release_delay = int(input())

current_month_index = months.index(current_month)
release_month_index = (current_month_index + release_delay) % 12
print(months[release_month_index])

class CodeforcesTask45ASolution:
    def __init__(self):
        self.result = ''
        self.start_month = 0
        self.target_month = 0

    def read_input(self):
        self.start_month = input()
        self.target_month = int(input())

    def process_task(self):
        months = ["January", "February", "March", "April", "May", "June",
                  "July", "August", "September", "October", "November", "December"]
        current = months.index(self.start_month) + 1
        to_go = (current + self.target_month) % 12
        if not to_go:
            to_go = 12
        self.result = months[to_go - 1]

    def get_result(self):
        return self.result

if __name__ == "__main__":
    Solution = CodeforcesTask45ASolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())

import calendar
a=input()
b=[calendar.month_name[i]for i in range(13)][1:]
print(b[(int(input())+b.index(a))%12])

from sys import stdin

m = {1 : 'January', 2 : 'February', 3 : 'March', 4 : 'April', 5 : 'May',
	6 : 'June', 7 : 'July', 8 : 'August', 9 : 'September',
	10 : 'October', 11 : 'November', 12 : 'December'}

def next():
	return stdin.readline().strip()

def main():
	mn = next()
	k = int(next())
	tm = 0

	for i in range(1, len(m)):
		if mn == m[i]:
			tm = i
	if (tm + k) % 12 == 0:
		l = 12
	else:
		l = (tm + k) % 12
	print "%s\n" % m[l]

if __name__ == "__main__":
	main()

m=input()
n=int(input())
list=["January","February","March","April","May","June","July","August","September","October","November","December"]
i=list.index(m)
n%=12
i+=n
i%=12
print(list[i])

def codecraft(s, k):
    monthes = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October',
               'November', 'December']
    return monthes[(monthes.index(s) + (k % 12)) % 12]

month = input()
number = int(input())
print(codecraft(month, number))

import calendar
s=input()
n=int(input())
arr=[]
for i in range(1,13):
    a=calendar.month_name[i]
    arr.append(a)
#print(arr)
print(arr[(arr.index(s)+n)%12])

m = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
x = input()
y = int(input())
print(m[(m.index(x) + y) % 12])

l = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
s = input()
n = int(input())
x = l.index(s)
print(l[(x + n) % 12])

months=['January','February','March','April','May','June','July','August','September','October','November','December']

m=input()
k=int(input())
q=months.index(m)
r=(q+k)%12
print(months[r])

s = input()
k = int(input())
d1 = {'January': 1, 'February': 2, 'March': 3, 'April': 4, 'May': 5, 'June': 6,
      'July': 7, 'August': 8, 'September': 9, 'October': 10, 'November': 11, 'December': 12}
d2 = {1: 'January', 2: 'February', 3: 'March', 4: 'April', 5: 'May', 6: 'June',
      7: 'July', 8: 'August', 9: 'September', 10: 'October', 11: 'November', 12: 'December'}
if (d1[s] + k) % 12 != 0:
    print(d2[(d1[s] + k) % 12])
else:
    print('December')

a = input()
b = int(input())
c = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
f = c.index(a)
h = '-'
if b % 12 ==0:
    print(a)
else:
    while h == '-':
        if b == 0:
            h = '+'
        else:
            b-=1
            if f == len(c)-1:
                f = 0
            else:
                f+=1
    print(c[f])

def main():
    mmm = ('January', 'February', 'March', 'April', 'May', 'June', 'July',
           'August', 'September', 'October', 'November', 'December')
    n = mmm.index(input())
    k = int(input())
    print(mmm[(n + k) % 12])

if __name__ == '__main__':
    main()

l=['January','February','March','April','May','June','July','August','September','October','November','December']
s=input()
n=int(input())
x=0
for i in range(12):
    if(s==l[i]):
        x=i
print(l[(x+n)%12])

m = {1:"January", 2:"February", 3:"March", 4:"April", 5:"May", 6:"June", 7:"July", 8:"August", 9:"September", 10:"October",11 :"November", 12:"December"}
im = {v: k for k, v in m.items()}
n = input("")
l = int(input(""))
if (im[n] + l) % 12 != 0:
    print(m[(im[n] + l) % 12])
else:
    print(n)

n = input()
k = int(input())
mylist = "None January February March April May June July August September October November December".split(" ")

try :
    if n in mylist :
        ind = (mylist.index(n) + k) % 12
        res = mylist[ind]
        print(res)
except ValueError :
        print("Error")

a=["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
inp=input()
b=int(input())

if b%12==0:
    print(inp)
elif(b<12):
    i=(a.index(inp))+1
    g=12-b
    h=i-g
    print(a[h-1])

dict={}
dict["January"]=1
dict["February"]=2
dict["March"]=3
dict["April"]=4
dict["May"]=5
dict["June"]=6
dict["July"]=7
dict["August"]=8
dict["September"]=9
dict["October"]=10
dict["November"]=11
dict["December"]=12
tmp=input()
s=int(input())
s+=dict[tmp]
s%=12
for i in dict:
	if(dict[i]==s):
		print(i)
		break

# -*- coding: utf-8 -*-
"""
Created on Sat May 23 16:28:35 2020

@author: Ritvik Agarwal
"""

mon = ["Months", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

m = input()
i = int(input())

n = mon.index(m)
i = (n+i) % 12

print(mon[i])

current=input()
monthsmore=int(input())
monthsmore=monthsmore%12
for i in range (monthsmore):
    if current=="January":
        current="February"
    elif current=="February":
        current="March"
    elif current=="March":
        current="April"
    elif current=="May":
        current="June"
    elif current=="June":
        current="July"
    elif current=="July":
        current="August"
    elif current=="August":
        current="September"
    elif current=="September":
        current="October"
    elif current=="October":
        current="November"
    elif current=="November":
        current="December"
    elif current=="December":
        current="January"
print (current)

mstr = input()
mint = 0
k = int(input())
if mstr == 'January':
    mint = 1
elif mstr == 'February':
    mint = 2
elif mstr == 'March':
    mint = 3
elif mstr == 'April':
    mint = 4
elif mstr == 'May':
    mint = 5
elif mstr == 'June':
    mint = 6
elif mstr == 'July':
    mint = 7
elif mstr == 'August':
    mint = 8
elif mstr == 'September':
    mint = 9
elif mstr == 'October':
    mint = 10
elif mstr == 'November':
    mint = 11
elif mstr == 'December':
    mint = 12
mint += k
mint = mint % 12
if mint == 1:
    print('January')
if mint == 2:
    print('February')
if mint == 3:
    print('March')
if mint == 4:
    print('April')
if mint == 5:
    print('May')
if mint == 6:
    print('June')
if mint == 7:
    print('July')
if mint == 8:
    print('August')
if mint == 9:
    print('September')
if mint == 10:
    print('October')
if mint == 11:
    print('November')
if mint == 12:
    print('December')

mstr = input()
mint = 0
k = int(input())
if mstr == 'January':
    mint = 1
elif mstr == 'February':
    mint = 2
elif mstr == 'March':
    mint = 3
elif mstr == 'April':
    mint = 4
elif mstr == 'May':
    mint = 5
elif mstr == 'June':
    mint = 6
elif mstr == 'July':
    mint = 7
elif mstr == 'August':
    mint = 8
elif mstr == 'September':
    mint = 9
elif mstr == 'October':
    mint = 10
elif mstr == 'November':
    mint = 11
elif mstr == 'December':
    mint = 12
mint += k
z = mint % 12
if z == 1:
    print('January')
elif z == 2:
    print('February')
elif z == 3:
    print('March')
elif z == 4:
    print('April')
elif z == 5:
    print('May')
elif z == 6:
    print('June')
elif z == 7:
    print('July')
elif z == 8:
    print('August')
elif z == 9:
    print('September')
elif z == 10:
    print('October')
elif z == 11:
    print('November')
elif z == 12:
    print('December')

import calendar
month = input()
inp = int(input())
miesiac = dict()
numer_miesiaca = 0

for i in range(12):
    miesiac[i+1] = calendar.month_name[i+1]

for key, value in miesiac.items():
    if value == month:
        numer_miesiaca = int(key)

liczba = (numer_miesiaca + inp) % 12

print(calendar.month_name[liczba])

import calendar
a=input()
b=[calendar.month_name[i]for i in range(12)]
print(b[(int(input())+b.index(a))%12])

#coding: utf-8
def main():
    table = {
        "January":0, "Feburary":1, "March":2,
        "April"  :3, "May"     :4, "June" :5,
        "July"   :6, "August"  :7, "September":8,
        "October":9,"November":10,"December":11
    }
    m = (table[raw_input()]+input()) % 12
    print dict([[j,i] for i,j in table.items()])[m]
main()

month = raw_input('')
if month == 'January':
    number=1
if month == 'February':
    number=2
if month == 'March':
    number=3
if month == 'April':
    number=4
if month == 'May':
    number=5
if month == 'June':
    number=6
if month == 'July':
    number=7
if month == 'August':
    number=8
if month == 'September':
    number=9
if month == 'October':
    number=10
if month == 'November':
    number=11
if month == 'December':
    number=12

next = input('')
number+=next
number = number%12

if number==1:
    print 'January'
if number==2:
    print 'February'

if number==3:
    print 'March'

if number==4:
    print 'April'

if number==5:
    print 'May'

if number==6:
    print 'June'

if number==7:
    print 'July'

if number==8:
    print 'August'

if number==9:
    print 'September'

if number==10:
    print 'October'

if number==11:
    print 'November'

if number==12:
    print 'December'

dc={'January':1, 'February':2, 'March':3, 'April':4, 'May':5, 'June':6, 'July':7, 'August':8, 'September':9, 'October':10, 'November':11, 'December':0}
s=input()
x=int(input())
j=(dc[s]+x)%12
print(j)
for n in dc:
  if dc[n]==j:
    print(n)
    break

dc={'January':1, 'February':2, 'March':3, 'April':4, 'May':5, 'June':6, 'July':7, 'August':8, 'September':9, 'October':10, 'November':11, 'December':12}
s=input()
x=int(input())
j=(dc[s]+x)%12
for n in dc:
  if dc[n]==j:
    print(n)
    break

from sys import stdin

m = {1 : 'January', 2 : 'February', 3 : 'March', 4 : 'April', 5 : 'May',
	6 : 'June', 7 : 'July', 8 : 'August', 9 : 'September',
	10 : 'October', 11 : 'November', 12 : 'December'}

def next():
	return stdin.readline().strip()

def main():
	mn = next()
	k = int(next())
	tm = 0

	for i in range(1, len(m)):
		if mn == m[i]:
			tm = i
	if (tm + k) % 12 == 0:
		l = 1
	else:
		l = (tm + k) % 12
	print "%s\n" % m[l]

if __name__ == "__main__":
	main()