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


def f(first, last):
    diff = last - first
    m = diff % 4
    res = 0
    # print(first, last, last - m, last + 1)
    if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res


print(f(A, B))
 A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def f(first, last):
    diff = last - first
    m = diff % 4
    res = 0
    # print(first, last, last - m, last + 1)
    if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res f diff = last - first diff last - first last first m = diff % 4 m diff % 4 diff 4 res = 0 res 0 if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res first % 2 == 0 first % 2 first 2 0 for i in reversed(range(last - m, last + 1)):
            res ^= i
         i reversed(range(last - m, last + 1)) reversed range(last - m, last + 1) range last - m last m last + 1 last 1 res ^= i res i return res res for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
         i reversed(range(last - m + 1, last + 1)) reversed range(last - m + 1, last + 1) range last - m + 1 last - m last m 1 last + 1 last 1 res ^= i res i res ^= first res first return res res first first last last print(f(A, B)) print f(A, B) f A B A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B def f(first, last):
    diff = last - first
    m = diff % 4
    res = 0
    # print(first, last, last - m, last + 1)
    if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res def f(first, last):
    diff = last - first
    m = diff % 4
    res = 0
    # print(first, last, last - m, last + 1)
    if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res f
A, B = map(int, input().split())


def f(first, last):
    diff = last - first
    m = diff % 4
    res = 0
    # print(first, last, last - m, last + 1)
    if first % 2 == 0:
        for i in reversed(range(last - m, last + 1)):
            res ^= i
        return res
    else:
        for i in reversed(range(last - m + 1, last + 1)):
            res ^= i
        res ^= first
        return res


print(f(A, B))

