#include <iostream>
using namespace std;

int Change(char a[], int b[]) {
    int ans = 0, k = 0;
    int ret = 1;
    for (int i = 49; i >= 0; i--) {
        if (a[i] == ',') //逗号表示前面还有一位数
		{
            i--;
            if (a[i - 1] != ',' && i > 0) {
                ret *= b[k++];
                ans += (((a[i - 1] - '0') * 10 + (a[i] - '0')) * ret);
                i--;
            } else {
                ret *= b[k++];
                ans += ((a[i] - '0') * ret);
            }
        } else if (a[i] == '1' || a[i] == '0')//遇到0或1表示到了最低位
		{
            ans = a[i] - '0';
        }
    }
    return ans;
}
void Change1(int a, int c[]) {
    int ret = 1, i = 0;
    char b[50];
    while (a >= ret) {
        if (a < ret * c[i])
            break;
        ret *= c[i++];
    }//i+1记录了a的位数
    int j = 0, k = 0;
    while (i > 0) {
        if (a == 0) {
            b[k++] = '0';
            b[k++] = ',';
            i--;
        } else {
            j = a / ret;
            a = a % ret;
            ret = ret / c[i - 1];
            if (j < 10) {
                b[k++] = j + '0';
            } else {
                int l;
                l = j / 10;
                j = j % 10;
                b[k++] = l + '0';
                b[k++] = j + '0';
            }
            b[k++] = ',';
            i--;
        }
    }
    b[k++] = a + '0';
    b[k] = '\0';//字符串以\0结尾
    cout << b << endl;
}
int main() {
    char a[50], b[50];
    int c[25];
    int i = 0, j = 2;
    int flag = 0;
    while (i < 25) {
        flag = 0;
        for (int k = 2; k * k <= j; k++) {
            if (j % k == 0 && j != k) {
                flag = 1;
                break;
            }
        }
        if (flag == 0) {
            c[i++] = j++;
        } else {
            j++;
        }
    }
    while (cin >> a >> b) {
        int ea, eb;
        ea = Change(a, c);
        eb = Change(b, c);
        Change1(ea + eb, c);
        return 0;
    }
}