#include "stdio.h"
int main()
{
    char ss[32], res[32] = {};
    gets(ss);

    int a = 0, b = 0;
    char* p = ss;
    for (; *p; ++p){
        if (*p == ' '){ ++p; break; }
        a = (a << 1) | (*p - '0');
    }
    for (; *p; ++p){
        if (*p == ' '){ ++p; break; }
        b = (b << 1) | (*p - '0');
    }

    int c = 0;
    switch (*p)
    {
    case '+': c = a + b; break;
    case '-': c = a - b; break;
    case '&': c = a & b; break;
    case '|': c = a | b; break;
    case '^': c = a ^ b; break;
    }

    p = &res[31];
    for (int i = 8; i--; c >>= 1){
        *--p = (c & 1) + '0';
    }
    printf("%s = %s", ss, p);
    return 0;
}