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

def ff(n):
    tmp = (n + 1) // 2
    tmp %= 2
    if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
    
ans = ff(a - 1) ^ ff(b)
print(ans) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def ff(n):
    tmp = (n + 1) // 2
    tmp %= 2
    if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
     ff tmp = (n + 1) // 2 tmp (n + 1) // 2 n + 1 n 1 2 tmp %= 2 tmp 2 if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
     n % 2 == 1 n % 2 n 2 1 return tmp tmp return n ^ tmp n ^ tmp n tmp n n ans = ff(a - 1) ^ ff(b) ans ff(a - 1) ^ ff(b) ff(a - 1) ff a - 1 a 1 ff(b) ff b print(ans) print ans a, b = map(int, input().split()) map(int, input().split()) a def ff(n):
    tmp = (n + 1) // 2
    tmp %= 2
    if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
     def ff(n):
    tmp = (n + 1) // 2
    tmp %= 2
    if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
     ff b = map(int, input().split()) map(int, input().split()) b ans = ff(a - 1) ^ ff(b) ff(a - 1) ^ ff(b) ans
a, b = map(int, input().split())

def ff(n):
    tmp = (n + 1) // 2
    tmp %= 2
    if n % 2 == 1:
        return tmp
    else:
        return n ^ tmp
    
ans = ff(a - 1) ^ ff(b)
print(ans)