Function to print the number of flips for both the sand timers
function flip ( a , b ) { let lcm = parseInt ( ( a * b ) / gcd ( a , b ) ) ; a = parseInt ( lcm / a ) ; b = parseInt ( lcm / b ) ; document . write ( ( a - 1 ) + " " + ( b - 1 ) ) ; }