r,g,b = map(int,input().split())
def get(c):# 将数字0 ~ 9转换成字符'0' ~ '9',将数字10 ~ 12转成字符'a' ~ 'c'
if c <= 9:
return str(c)
return chr(c - 10 + ord('A'))
def convert(x):# 将十进制x转成13进制res
if x == 0:# 一定要特判一下是否等于0,如果不写这个特判,那么while循环一次都不会执行,最后直接返回空串了
return "0"
res = ''
while x:
res = get(x % 13) + res
x //= 13
return res
R = convert(r)
if len(R) < 2:
R = "0" + R
G = convert(g)
if len(G) < 2:
G = "0" + G
B = convert(b)
if len(B) < 2:
B = "0" + B
print(f"#{R}{G}{B}")