#include #include #include using namespace std; long gcd(long a,long b){return b?gcd(b,a%b):a;} long T1,T2,T3; vector >ans; pairmul(long t,pairx) { pairret=x; ret.second*=t; long g=gcd(ret.first,ret.second); ret.first/=g; ret.second/=g; ret.first%=ret.second; ret.first=min(ret.first,ret.second-ret.first); return ret; } void f(long t1,long t2) { pairp=make_pair(t1*t2,t2-t1); long g=gcd(p.first,p.second); p.first/=g; p.second/=g; pairX[3]={mul(T1,p),mul(T2,p),mul(T3,p)}; if(X[0]==X[1]&&X[1]==X[2]&&X[2]==X[0])ans.push_back(p); } main() { cin>>T1>>T2>>T3; long lcm=T1/gcd(T1,T2)*T2; lcm=lcm/gcd(lcm,T3)*T3; ans.push_back(make_pair(lcm,1)); f(T1,T2); f(T1,T3); f(T2,T3); sort(ans.begin(),ans.end(),[](paira,pairb){ return a.first*b.second