#include <stdio.h>

int main() {
   int a,b,c;
   scanf("%X %o",&a,&b);
c = a + b;
printf("%d",c);
    return 0;
}