program main implicit none integer*8::A,B,AA,BB,AB,ABA,ABB read *,A,B AB = gcd(A,B) ABA= gcd((A+B)/AB,A/AB) ABB= gcd((A+B)/AB/ABA,B) print '(i0)',ABA*ABB*AB contains recursive function gcd(a,b) result(c) integer*8::a,b,c if(b.eq.0) then c = a else c = gcd(b,MOD(a,b)) end if end function gcd end program main