#include <stdio.h>
#include <string.h>

int main()
{
    char str[1024] = {0};
    int store = 0;
    char *end;
    while (NULL != fgets(str, sizeof(str), stdin)) {
        if (str[0] == '0' && str[1] == 'x') {
            store = strtol(str+2, end, 16);
            printf("%d\n", store);
        }
        memset(str, 0 , sizeof(str));
    }
    return 0;
}