#include <iostream> #include <string.h> #include <cmath> using namespace std; int main() { string str; while(cin>>str) { int sum = 0; int j= 0 ;//阶数 for(int i = str.length()-1;i>1;i--) { if(str[i]>='0'&&str[i]<='9') { sum+=((str[i]-'0')*pow(16,j)); j++; } else if(str[i]>='A'&&str[i]<='F') { sum+=((str[i]-'A'+10)*pow(16,j)); j++; } } cout<<sum<<endl; } return 0; }