a1,b1=map(int,input().split())
a=[0]*40
b=[0]*40
A=a1
B=b1
for i in range(1,41):
    a[-i]=a1%2
    b[-i]=b1%2
    a1=a1//2
    b1=b1//2
ans=[0]*40
if a[-1]==1:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1
else:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1
for i in range(2,41):
    if a[-i]==1 and a[-1]==1:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=0
        else:
            ans[-i]=1
    else:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=1
        else:
            ans[-i]=0
ans1=0
for i in range(1,41):
    ans1+=(2**(i-1))*ans[-i]
print(ans1) a1,b1=map(int,input().split()) a1 map(int,input().split()) map int input().split() ().split () input split b1 a=[0]*40 a [0]*40 [0] 0 40 b=[0]*40 b [0]*40 [0] 0 40 A=a1 A a1 B=b1 B b1 for i in range(1,41):
    a[-i]=a1%2
    b[-i]=b1%2
    a1=a1//2
    b1=b1//2 i range(1,41) range 1 41 a[-i]=a1%2 a[-i] a -i i a1%2 a1 2 b[-i]=b1%2 b[-i] b -i i b1%2 b1 2 a1=a1//2 a1 a1//2 a1 2 b1=b1//2 b1 b1//2 b1 2 ans=[0]*40 ans [0]*40 [0] 0 40 if a[-1]==1:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1
else:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1 a[-1]==1 a[-1] a -1 1 if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1 (a[-2]-b[-2])%2==0 (a[-2]-b[-2])%2 a[-2]-b[-2] a[-2] a -2 b[-2] b -2 2 0 if b[-1]==1:
            ans[-1]=1
     b[-1]==1 b[-1] b -1 1 ans[-1]=1 ans[-1] ans -1 1 if b[-1]==0:
            ans[-1]=1 b[-1]==0 b[-1] b -1 0 ans[-1]=1 ans[-1] ans -1 1 if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1 (a[-2]-b[-2])%2==0 (a[-2]-b[-2])%2 a[-2]-b[-2] a[-2] a -2 b[-2] b -2 2 0 if b[-1]==1:
            ans[-1]=1
     b[-1]==1 b[-1] b -1 1 ans[-1]=1 ans[-1] ans -1 1 if b[-1]==0:
            ans[-1]=1 b[-1]==0 b[-1] b -1 0 ans[-1]=1 ans[-1] ans -1 1 for i in range(2,41):
    if a[-i]==1 and a[-1]==1:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=0
        else:
            ans[-i]=1
    else:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=1
        else:
            ans[-i]=0 i range(2,41) range 2 41 if a[-i]==1 and a[-1]==1:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=0
        else:
            ans[-i]=1
    else:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=1
        else:
            ans[-i]=0 a[-i]==1 and a[-1]==1 a[-i]==1 a[-i] a -i i 1 a[-1]==1 a[-1] a -1 1 if b[-i]==1 and b[-1]==0:
            ans[-i]=0
        else:
            ans[-i]=1
     b[-i]==1 and b[-1]==0 b[-i]==1 b[-i] b -i i 1 b[-1]==0 b[-1] b -1 0 ans[-i]=0 ans[-i] ans -i i 0 ans[-i]=1 ans[-i] ans -i i 1 if b[-i]==1 and b[-1]==0:
            ans[-i]=1
        else:
            ans[-i]=0 b[-i]==1 and b[-1]==0 b[-i]==1 b[-i] b -i i 1 b[-1]==0 b[-1] b -1 0 ans[-i]=1 ans[-i] ans -i i 1 ans[-i]=0 ans[-i] ans -i i 0 ans1=0 ans1 0 for i in range(1,41):
    ans1+=(2**(i-1))*ans[-i] i range(1,41) range 1 41 ans1+=(2**(i-1))*ans[-i] ans1 (2**(i-1))*ans[-i] 2**(i-1) 2 i-1 i 1 ans[-i] ans -i i print(ans1) print ans1 b1=map(int,input().split()) map(int,input().split()) b1 a1=a1//2 a1//2 a1 ans=[0]*40 [0]*40 ans b1=b1//2 b1//2 b1 b=[0]*40 [0]*40 b A=a1 a1 A a1,b1=map(int,input().split()) map(int,input().split()) a1 a=[0]*40 [0]*40 a ans1=0 0 ans1 B=b1 b1 B ans1+=(2**(i-1))*ans[-i] (2**(i-1))*ans[-i] ans1
a1,b1=map(int,input().split())
a=[0]*40
b=[0]*40
A=a1
B=b1
for i in range(1,41):
    a[-i]=a1%2
    b[-i]=b1%2
    a1=a1//2
    b1=b1//2
ans=[0]*40
if a[-1]==1:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1
else:
    if (a[-2]-b[-2])%2==0:
        if b[-1]==1:
            ans[-1]=1
    else:
        if b[-1]==0:
            ans[-1]=1
for i in range(2,41):
    if a[-i]==1 and a[-1]==1:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=0
        else:
            ans[-i]=1
    else:
        if b[-i]==1 and b[-1]==0:
            ans[-i]=1
        else:
            ans[-i]=0
ans1=0
for i in range(1,41):
    ans1+=(2**(i-1))*ans[-i]
print(ans1)
