t = 3.times.map{ gets.to_i } p = t.inject(:lcm) n = t.map{|ti| p / ti } q = [ n[0] - n[1], n[1] - n[2] ].min puts "#{p}/#{q}"