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

    except:
        break