def baseN(num,b): return ((num==0) and '0') or (baseN(num/b,b).lstrip('0') + '0123456789ABCDEF'[int(num%b)]) print(baseN(int(input()),6))
def baseN(num,b): return ((num==0) and '0') or (baseN(num/b,b).lstrip('0') + '0123456789ABCDEF'[int(num%b)]) print(baseN(int(input()),6))