s = input() if s[0] != "x": print(int(s)) else: s = int(s[1:]) print((1<<32) - s)