while True:

    try:

        nums = eval(input())

    except:

        break

    a = list(map(int, list(nums)))

    while len(a) > 1:

        a = list(map(int, [str(a[i]+a[i+1])[-1] for i in range(len(a)-1)]))

    print((*a))
while True:

    try:

        nums = eval(input())

    except:

        break

    a = list(map(int, list(nums)))

    while len(a) > 1:

        a = [(a[i]+a[i+1])%10 for i in range(len(a)-1)]

    print((*a))
while True:
    try:
        nums = eval(input())
    except:
        break
    a = list(map(int, list(nums)))
    while len(a) > 1:
        a = list(map(int, [str(a[i] + a[i + 1])[-1] for i in range(len(a) - 1)]))
    print((*a))

while True:
    try:
        nums = eval(input())
    except:
        break
    a = list(map(int, list(nums)))
    while len(a) > 1:
        a = [(a[i] + a[i + 1]) % 10 for i in range(len(a) - 1)]
    print((*a))

-        a = list(map(int, [str(a[i] + a[i + 1])[-1] for i in range(len(a) - 1)])) +        a = [(a[i] + a[i + 1]) % 10 for i in range(len(a) - 1)]