#include <bits/stdc++.h> using namespace std; int main(){ string a_line, b_line; int a = 16; int b = 10; while (cin >> a_line){ vector<int> num; for (int i=2; i<a_line.size(); i++){ if (isdigit(a_line[i])){ num.push_back(a_line[i] - '0'); } else if (a_line[i] >= 'A' && a_line[i] <= 'Z'){ num.push_back(a_line[i] - 'A' + 10); } } reverse(num.begin(), num.end()); vector<int> res; while (num.size()){ int r = 0; for (int i=num.size()-1; i>=0; i--){ num[i] = num[i] + a*r; r = num[i] % b; num[i] = num[i] / b; } res.push_back(r); while (num.size() && num.back() == 0) num.pop_back(); } reverse(res.begin(), res.end()); for (auto item : res){ if (item >=0 && item <= 9) cout << item; else { cout << char(item-10+'A'); } } puts(""); } return 0; }