from itertools import zip_longest

def to_base(s, n):
    t = 0

    for i,c in enumerate(s[::-1]):
        if isinstance(c, int):
            t += c * n**i
        else:
            t += ord(c) * n**i

    return t

def f(s):
    L = [""]
    s = list(s)

    while s:
        L[-1] += s.pop()

        if len(L[-1]) == 600:
            L.append("")

    Jb = [to_base(r, 19) for r in L]
    a = to_base(Jb, 13)

    L = [list(filter(None, r)) for r in zip_longest(*L)]
    Jb = [to_base(r, 19) for r in L]
    b = to_base(Jb, 13)

    a %= 16**20
    b %= 16**20

    A, B = divmod(a, 16**12)
    C, D = divmod(b, 16**12)
    E = A*11 + C
    E %= 4**16

    return to_base([E, B, D], 16**12)
    
print(f(input()))