# Arup Guha
# Grading "script" for CIS 3362 Hmk #5 Question 9
# 11/8/2019

# Given values
n = 135966249934813212187094231381
d = 101780276937277277681723772371

# Fast modular exponentiation
def modpow(b,exp,mod):

    # Base case.
    if exp == 0:
        return 1

    # Time savings here, go halfway and square.
    if exp%2 == 0:
        tmp = modpow(b,exp//2,mod)
        return (tmp*tmp)%mod

    # Usual breakdown.
    return (modpow(b,exp-1,n)*b)%mod

def convertBack(val):
    res = ""
    for i in range(16):
        res = numToChar(val%64) + res
        val = val // 64;

    return res

def numToChar(val):
    if val < 26:
        return chr(val+ord('A'))
    elif val < 52:
        return chr(val-26+ord('a'))
    elif val < 62:
        return chr(val-52+ord('0'))
    elif val == 62:
        return '+'
    return '/'

def main():
    
    # Read in the whole file.
    file = open("msg.out", "r")
    toks = file.read().split()

    # Decrypt each token and output to standard output.
    for i in range(len(toks)):

        msg = int(toks[i])
        print(convertBack(modpow(msg, d, n)))

    file.close()

main()
