T = input() if T[0] != 'x': print(int(T)) else: print(2 ** 32 - int(T[1:]))