while True: try: a = input() b = int(a,16) print(b) except:  ...