# Arup Guha
# 11/6/2020
# Verifier for CIS 3362 Homework #6

from sys import stdin

# This is what I need to verify.
n = 5959543795627426174320202010482251983
d = 3559217891888419062566936314863048839

# Returns (base**exp) % mod, efficiently.
def fastmodexpo(base,exp,mod):

    # Base case.
    if exp == 0:
        return 1

    # Speed up here with even exponent.
    if exp%2 == 0:
        tmp = fastmodexpo(base,exp//2,mod)
        return (tmp*tmp)%mod

    # Odd case, must just do the regular ways.
    return (base*fastmodexpo(base,exp-1,mod))%mod

# Converts the number num which should represent numchars Radix-64 chars, into
# a string and returns that string.
def convert(num,numchars):

    res = ""

    # Peel of chars.
    for i in range(numchars):

        # Get this last one...convert and append to front.
        cur = num%64
        res = toradix64(cur) + res

        # Get rid of this character from the number.
        num = num//64

    return res

# Returns the Radix-64 character that maps to the integer c (must be in between
# 0 and 63, inclusive.
def toradix64(c):
    if c < 26:
        return chr(c+ord('A'))
    if c < 52:
        return chr(c-26+ord('a'))
    if c < 62:
        return chr(c-52+ord('0'))
    if c == 62:
        return '+'
    return '/'

def main():

    # Read each line.
    for line in stdin:

        # Convert to int.
        line = line.strip()
        val = int(line)

        # Get plaintext.
        plain = fastmodexpo(val, d, n)

        # convert and print.
        print(convert(plain,20))

# Go
main()
