#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int func(char a) {
return a - 'A' + 10;
}
int main() {
string str;
cin >> str;
long res = 0;
int count = 0;
for (int i = str.size() - 1; i > 1; i--) {
if (isdigit(str[i])) {
res += (str[i] - '0') * pow(16, count++);
} else {
res += func(str[i]) * pow(16, count++);
}
}
cout << res << endl;
}

京公网安备 11010502036488号