A, B = map(int, input().split())

def calc(a):
    if a < 0:
        return 0
    ans = 0
    for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
    return ans

print(calc(B) ^ calc(A-1)) A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def calc(a):
    if a < 0:
        return 0
    ans = 0
    for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
    return ans calc if a < 0:
        return 0
     a < 0 a 0 return 0 0 ans = 0 ans 0 for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
     i range(50) range 50 loop = 2 ** (i+1) loop 2 ** (i+1) 2 i+1 i 1 cnt = (a // loop) * (loop // 2) cnt (a // loop) * (loop // 2) a // loop a loop loop // 2 loop 2 cnt += max(0, a % loop+1 - loop // 2) cnt max(0, a % loop+1 - loop // 2) max 0 a % loop+1 - loop // 2 a % loop+1 a % loop a loop 1 loop // 2 loop 2 if cnt % 2 == 1:
            ans += 2 ** i
     cnt % 2 == 1 cnt % 2 cnt 2 1 ans += 2 ** i ans 2 ** i 2 i return ans ans a a print(calc(B) ^ calc(A-1)) print calc(B) ^ calc(A-1) calc(B) calc B calc(A-1) calc A-1 A 1 A, B = map(int, input().split()) map(int, input().split()) A def calc(a):
    if a < 0:
        return 0
    ans = 0
    for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
    return ans def calc(a):
    if a < 0:
        return 0
    ans = 0
    for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
    return ans calc B = map(int, input().split()) map(int, input().split()) B
A, B = map(int, input().split())

def calc(a):
    if a < 0:
        return 0
    ans = 0
    for i in range(50):
        loop = 2 ** (i+1)
        cnt = (a // loop) * (loop // 2)
        cnt += max(0, a % loop+1 - loop // 2)
        if cnt % 2 == 1:
            ans += 2 ** i
    return ans

print(calc(B) ^ calc(A-1))