#include <stdio.h>
int main() {
    long long int a, b;
    scanf("%X%o",&a,&b);
printf("%lld",a+b);
    return 0;
}