a,b=map(int,input().split())
a-=1

def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans

print(allx(b)^allx(a)) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b a-=1 a 1 def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans allx ans=0 ans 0 for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
     i range(40) range 40 if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
         i==0 i 0 if n%4==2 or n%4==1:
                ans+=1
                continue
         n%4==2 or n%4==1 n%4==2 n%4 n 4 2 n%4==1 n%4 n 4 1 ans+=1 ans 1 continue c= pow(2,i+1) c pow(2,i+1) pow 2 i+1 i 1 k=n% c k n% c n c if k>=c//2 and k%2==0:
          ans+=pow(2,i)
     k>=c//2 and k%2==0 k>=c//2 k c//2 c 2 k%2==0 k%2 k 2 0 ans+=pow(2,i) ans pow(2,i) pow 2 i return ans ans n n print(allx(b)^allx(a)) print allx(b)^allx(a) allx(b) allx b allx(a) allx a def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans allx a-=1 1 a b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a
a,b=map(int,input().split())
a-=1

def allx(n):
    ans=0
    for i in range(40):
        if i==0:
            if n%4==2 or n%4==1:
                ans+=1
                continue
        c= pow(2,i+1)
        k=n% c
        
        if k>=c//2 and k%2==0:
          ans+=pow(2,i)
    return ans

print(allx(b)^allx(a))