include <bits/stdc++.h>

using namespace std;

int main() {
int inNum;
while (cin >> hex >> inNum) {
cout << dec << inNum << endl;
}
return 0;
}