a,b = map(int,input().split())
c,d = map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b])
print(c^d) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b c,d = map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) c map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) map lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2 (x//2)%2^1 if x%2 else x^(x//2)%2 x%2 x 2 (x//2)%2^1 (x//2)%2 x//2 x 2 2 1 x^(x//2)%2 x (x//2)%2 x//2 x 2 2 x [a-1,b] a-1 a 1 b d print(c^d) print c^d c d c,d = map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) c d = map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b]) d a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
a,b = map(int,input().split())
c,d = map(lambda x:(x//2)%2^1 if x%2 else x^(x//2)%2,[a-1,b])
print(c^d)