1 #include <iostream> 2 #include <cstdio> 3 #include <vector> 4 #include <queue> 5 #include <map> 6 #include <cmath> 7 #include <stack> 8 #include <cstring> 9 #include <algorithm> 10 #include <cstdlib> 11 #define FOR(i,x,n) for(long i=x;i<n;i++) 12 #define ll long long int 13 #define INF 0x3f3f3f3f 14 #define MOD 1000000007 15 #define MAX_N 50005 16 17 using namespace std; 18 19 int a[200]; 20 char s[20]; 21 22 int main() 23 { 24 //freopen("input1.txt", "r", stdin); 25 //freopen("data.out", "w", stdout); 26 ll n; 27 int cou=0; 28 ll ans=0; 29 scanf("%s",s); 30 int len=strlen(s); 31 FOR(i,0,len){ 32 if(s[i]>='A'&&s[i]<='F'){ 33 ans+=(s[i]-'A'+10)*pow(16,len-i-1); 34 }else{ 35 ans+=(s[i]-'0')*pow(16,len-i-1); 36 } 37 } 38 printf("%lld",ans); 39 //fclose(stdin); 40 //fclose(stdout); 41 return 0; 42 }