#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef complex P; typedef pair pii; #define REP(i,n) for(ll i=0;i>t1>>t2>>t3; Ratio p = {t1,t2-t1}; yakubun(p); Ratio p2 = p; p2.up *= t2; p2.down *= t3; yakubun(p2); int N; // n t1 t3 = n t1 t2 { ll x = t1 * (t3-t2); ll y = t3 * (t2-t1); if(x % y == 0){ N = 1; }else{ ll g = __gcd(x,y); N = y/g; } } Ratio ans = {N*t1*t2, t2-t1}; yakubun(ans); printf("%lld/%lld\n",ans.up,ans.down); return 0; }