#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%0x", &n);
    printf("%d\n", n);
    return 0;
}