文件目录

#include <iostream>
using namespace std;

int bto10(string s, int b)
{
    int a = 1, sum = 0;
    for (int i = s.size() - 1; i >= 0; i--)
    {
        sum += (s[i] - 48) * a;
        a *= b;
    }
    return sum;
}

int main()
{
    string p, q, r;
    cin >> p >> q >> r;
    int k = 2;
    for (int i = 0; p[i]; i++)
        if (p[i] - 48 > k)
            k = p[i] - 48 + 1;
    for (int i = 0; q[i]; i++)
        if (q[i] - 48 > k)
            k = q[i] - 48 + 1;
    for (int i = 0; r[i]; i++)
        if (r[i] - 48 > k)
            k = r[i] - 48 + 1;
    int ans = 0;
    for (int b = k; b <= 40; b++)
    {
        if (bto10(p, b) * bto10(q, b) == bto10(r, b))
        {
            ans = b;
            break;
        }
    }
    cout << ans;
    return 0;
}