while True:
    try:
        num=input()
        a=int(num,16)
        print(a)
    except:
        break