#include <iostream> #include <vector> using namespace std; int main() { string str; while (cin >> str) { str=str.substr(2); long long answer=0; for(int i=0;i<str.size();i++) { answer*=16; char x=str[i]; if(x>='0'&&x<='9') answer+=str[i]-'0'; else{ answer+=str[i]-'A'+10; } } cout<<answer<<endl; } }