#include #include #include #include using namespace std; int main(){ int a,b,c;scanf("%d%d%d",&a,&b,&c); long long cm=(long long)a*b;if(a>b)swap(a,b); int ans=2*1000000000; int n=a,m=b; int x=0;while(x=m%n){m=n;n=x;};//cm/=n; a/=n;b/=n; c=(c+n-1)/n*n; for(int i=0;i<=a;i++,c+=n){ a; } printf("%d\n",ans); return 0; }