#include<iostream>
using namespace std;

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