#include<bits/stdc++.h>
using namespace std;
int main(){
char m;
cin>>m;
switch(m){
case '0':cout<<0;break;
case '1':cout<<1;break;
case '2':cout<<2;break;
case '3':cout<<3;break;
case '4':cout<<4;break;
case '5':cout<<5;break;
case '6':cout<<6;break;
case '7':cout<<7;break;
case '8':cout<<8;break;
case '9':cout<<9;break;
case 'A':cout<<10;break;
case 'B':cout<<11;break;
case 'C':cout<<12;break;
case 'D':cout<<13;break;
case 'E':cout<<14;break;
case 'F':cout<<15;break;
}
return 0;
}