a,b = map(int,input().split())
if a % 2 == 0:
    if (b - a + 1) % 2 == 0:
        if (b-a + 1) % 4 == 0:
            print(0)
        else:
            print(1)
    else:
        if (b - a) % 4 == 0:
            print(0^b)
        else:
            print(1^b)
else:
    if (b - a) % 2 == 0:
        if (b-a) % 4 == 0:
            print(a^0)
        else:
            print(a^1)
    else:
        if (b - a - 1) % 4 == 0:
            print(0^b^a)
        else:
            print(1^b^a) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b if a % 2 == 0:
    if (b - a + 1) % 2 == 0:
        if (b-a + 1) % 4 == 0:
            print(0)
        else:
            print(1)
    else:
        if (b - a) % 4 == 0:
            print(0^b)
        else:
            print(1^b)
else:
    if (b - a) % 2 == 0:
        if (b-a) % 4 == 0:
            print(a^0)
        else:
            print(a^1)
    else:
        if (b - a - 1) % 4 == 0:
            print(0^b^a)
        else:
            print(1^b^a) a % 2 == 0 a % 2 a 2 0 if (b - a + 1) % 2 == 0:
        if (b-a + 1) % 4 == 0:
            print(0)
        else:
            print(1)
    else:
        if (b - a) % 4 == 0:
            print(0^b)
        else:
            print(1^b) (b - a + 1) % 2 == 0 (b - a + 1) % 2 b - a + 1 b - a b a 1 2 0 if (b-a + 1) % 4 == 0:
            print(0)
        else:
            print(1)
     (b-a + 1) % 4 == 0 (b-a + 1) % 4 b-a + 1 b-a b a 1 4 0 print(0) print 0 print(1) print 1 if (b - a) % 4 == 0:
            print(0^b)
        else:
            print(1^b) (b - a) % 4 == 0 (b - a) % 4 b - a b a 4 0 print(0^b) print 0^b 0 b print(1^b) print 1^b 1 b if (b - a) % 2 == 0:
        if (b-a) % 4 == 0:
            print(a^0)
        else:
            print(a^1)
    else:
        if (b - a - 1) % 4 == 0:
            print(0^b^a)
        else:
            print(1^b^a) (b - a) % 2 == 0 (b - a) % 2 b - a b a 2 0 if (b-a) % 4 == 0:
            print(a^0)
        else:
            print(a^1)
     (b-a) % 4 == 0 (b-a) % 4 b-a b a 4 0 print(a^0) print a^0 a 0 print(a^1) print a^1 a 1 if (b - a - 1) % 4 == 0:
            print(0^b^a)
        else:
            print(1^b^a) (b - a - 1) % 4 == 0 (b - a - 1) % 4 b - a - 1 b - a b a 1 4 0 print(0^b^a) print 0^b^a 0^b 0 b a print(1^b^a) print 1^b^a 1^b 1 b a 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())
if a % 2 == 0:
    if (b - a + 1) % 2 == 0:
        if (b-a + 1) % 4 == 0:
            print(0)
        else:
            print(1)
    else:
        if (b - a) % 4 == 0:
            print(0^b)
        else:
            print(1^b)
else:
    if (b - a) % 2 == 0:
        if (b-a) % 4 == 0:
            print(a^0)
        else:
            print(a^1)
    else:
        if (b - a - 1) % 4 == 0:
            print(0^b^a)
        else:
            print(1^b^a)
