#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  string s;
  cin>>s;
  string t;
  bool b=true;
  if(s[0]=='x'){
    t=s.substr(1);
    b=false;
  }
  else t=s;
  
  ll a=stoll(t);
  if(b) cout<<a<<endl;
  else cout<<(1LL<<32)-a<<endl;
    
  return 0;
}