#include<iostream>
#include<cmath>
#include<iomanip>
#include <algorithm>
#include<string>
using namespace std;
int Binary(long long t)
{
int a[100] = {};
int x;
for (x = 0; t / 10; x++)
{
a[x] = t % 10;
t = t / 10;
}
a[x] = t;
int maxbin = 0;
for (int y = 0; y < x + 1; y++)
maxbin = max(maxbin, a[y]);
return maxbin;
}
long long Changebin(long long before, int cnum)
{
long long after = 0;
int b[1000] = {};
int x;
for (x = 0; before / 10; x++)
{
b[x] = before % 10;
before /= 10;
}
b[x] = before;
for (int j = 0; j < x + 1; j++)
after += b[j] * pow(cnum, j);
return after;
}
int main(void)
{
long long p, q, r;
long long p1, q1, r1;
cin >> p >> q >> r;
int binarynum = max(Binary(p),max(Binary(q),Binary(r)));
int i;
for (i = binarynum ; i < 17; i++)
{
p1 = Changebin(p, i);
q1 = Changebin(q, i);
r1 = Changebin(r, i);
if (p1 * q1 == r1)
break;
}
if (i == 17)
i = 0;
cout << i;
}