#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int Prime[30];
bool isPrime(int x)
{
    if(x <= 3) return x > 1;
    if(x % 6 != 1 && x % 6 != 5) return false;
    for(int i = 5; i * i <= x; i += 5)
    {
        if(x % (i + 2) == 0 || x % i == 0) return false;
    }
    return true;
}
vector<int> str_vec(string &a)
{
    vector<int> va;
    a += ",";
    int t = 0;
    for(int i = 0; i < a.size(); i ++)
    {
        while(a[i] != ',') t = t * 10 + a[i ++] - '0';
        va.push_back(t);
        t = 0;
    }
    reverse(va.begin(), va.end());
    return va;
}
string vec_str(vector<int>& v)
{
    int n = v.size();
    string s;
    s += to_string(v[n - 1]);
    for(int i = n - 2; i >= 0; i --)
    {
        s += ",";
        s += to_string(v[i]);
    }
    return s;
}
string add(string& a, string& b)
{
    vector<int> va = str_vec(a), vb = str_vec(b);
    vector<int> res;
    int t = 0, cnt = 1;
    for(int i = 0; i < va.size() || i < vb.size(); i ++)
    {
        if(i < a.size()) t += va[i];
        if(i < b.size()) t += vb[i];
        int p = Prime[cnt ++];
        res.push_back(t % p);
        t /= p;
    }
    if(t) res.push_back(t);
    return vec_str(res);
}
int main() {
    int cnt = 1;
    for(int i = 2; cnt <= 25; i ++ )
    {
        if(isPrime(i)) Prime[cnt ++] = i;
    }
    string a, b;
    while (cin >> a >> b) { // 注意 while 处理多个 case
        cout << add(a, b);
    }
    return 0;
}
// 64 位输出请用 printf("%lld")