import java.io.*; import java.util.*; import java.awt.geom.*; /** * Solution to Speed Can Cost You * * @author vanb */ public class speed_vanb { public Scanner sc; public PrintStream ps; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); //new File( "speed.judge" ) ); ps = System.out; //new PrintStream( new FileOutputStream( "speed.solution" ) ); for(;;) { int distance = sc.nextInt(); if( distance==0 ) break; double s1 = sc.nextDouble(); double s2 = sc.nextDouble(); // Time, in seconds, to travel the given distance at the given speed. // distance/s1 and distance/s2 give the times in hours, since speed is in MPH // So, we've got to multiply by 60*60 to convert hours to seconds double t1 = distance * 60.0 * 60.0 / s1; double t2 = distance * 60.0 * 60.0 / s2; // Difference in seconds, rounded int dt = (int)Math.round( t1-t2 ); // Break out hours, minutes, seconds int seconds = dt % 60; int minutes = (dt / 60) % 60; int hours = dt / 60 / 60; ps.printf( "%d:%02d:%02d", hours, minutes, seconds ); ps.println(); } } /** * @param args */ public static void main( String[] args ) throws Exception { new speed_vanb().doit(); } }