s = gets.chomp t = s.start_with?('x') ? 2**32 - s[1..-1].to_i : s.to_i puts t