#include<bits/stdc++.h>
using namespace std;
int n,m,z,j=1,a,b,c;
int jzb(int n,int m){
int x,y=0,result=0;
while(m!=0){
x=m%10;
m/=10;
result+=x*pow(n,y);
y++;
}
return result;
}
int main(){
cin>>n>>m>>z;
while(j<100){
j++;
a=jzb(j,n);
b=jzb(j,m);
c=jzb(j,z);
if(a*b==c){
cout<<j;
return 0;
}
}
cout<<0;
return 0;
}