#include "stdio.h" #include "string.h" int disposeStr(char c) { if (c >= 'a') return (c - 'a' + 10); else if (c >= 'A') return (c - 'A' + 10); else return (c - '0'); } int dispose16(int n) { int count = 1; for (int i = 0; i < n; i++) { count *= 16; } return count; } int main(void) { char str[10]; int num; int count; #pragma warning(suppress : 4996) while (scanf("%s", str) != EOF) { count = 0; num = strlen(str); for (int i = 2; i < num; i++) { count = disposeStr(str[i]) * dispose16(num - i - 1) + count; } printf("%d\r\n",count); } return 0; }