import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

bt = 0
if b % 2:
    bt = ((b + 1) // 2) % 2
else:
    bt = (b // 2) % 2
    bt ^= b

at = 0
if (a - 1) % 2:
    at = (a // 2) % 2
else:
    at = ((a - 1) // 2) % 2
    at ^= (a - 1)

print(bt ^ at) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b bt = 0 bt 0 if b % 2:
    bt = ((b + 1) // 2) % 2
else:
    bt = (b // 2) % 2
    bt ^= b b % 2 b 2 bt = ((b + 1) // 2) % 2 bt ((b + 1) // 2) % 2 (b + 1) // 2 b + 1 b 1 2 2 bt = (b // 2) % 2 bt (b // 2) % 2 b // 2 b 2 2 bt ^= b bt b at = 0 at 0 if (a - 1) % 2:
    at = (a // 2) % 2
else:
    at = ((a - 1) // 2) % 2
    at ^= (a - 1) (a - 1) % 2 a - 1 a 1 2 at = (a // 2) % 2 at (a // 2) % 2 a // 2 a 2 2 at = ((a - 1) // 2) % 2 at ((a - 1) // 2) % 2 (a - 1) // 2 a - 1 a 1 2 2 at ^= (a - 1) at a - 1 a 1 print(bt ^ at) print bt ^ at bt at bt = ((b + 1) // 2) % 2 ((b + 1) // 2) % 2 bt at = ((a - 1) // 2) % 2 ((a - 1) // 2) % 2 at b = map(int, input().split()) map(int, input().split()) b a,b = map(int, input().split()) map(int, input().split()) a bt = (b // 2) % 2 (b // 2) % 2 bt at = 0 0 at bt ^= b b bt bt = 0 0 bt at = (a // 2) % 2 (a // 2) % 2 at at ^= (a - 1) a - 1 at input = sys.stdin.readline sys.stdin.readline input
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

bt = 0
if b % 2:
    bt = ((b + 1) // 2) % 2
else:
    bt = (b // 2) % 2
    bt ^= b

at = 0
if (a - 1) % 2:
    at = (a // 2) % 2
else:
    at = ((a - 1) // 2) % 2
    at ^= (a - 1)

print(bt ^ at)
