#include <iostream>
#include <string>
using namespace std;
int hex2dec(string hex){
int n = hex.size(), num = 0, radix = 16, product = 1;
for(int i = n - 1; i >= 0 && hex[i] != 'x'; i--){
int h = 0;
if(hex[i] >= '0' && hex[i] <= '9'){
h = hex[i] - '0';
} else if(hex[i] >= 'A' && hex[i] <= 'F'){
h = (hex[i] - 'A') + 10;
}
num += h * product;
product *= radix;
}
return num;
}
int main() {
string h;
while(cin >> h){
cout << hex2dec(h) << endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")
//12 * 16 + 2



京公网安备 11010502036488号