#include <iostream>
using namespace std;

int main() {
    int n;
    while(cin>>hex>>n)
        cout<<dec<<n<<endl;
}