while True: try: hexNum = hex(int(input(), 16)) intNum = int(hexNum, 16) print(intNum) except: break