input = gets.split(" ").map{|i| i.to_i} case input[0] when 1 puts input[1] puts input[2] else a = input[3] * (input[0] - 1) b = input[2] + a c = input[1] + b / 60 d = b % 60 puts c % 24 puts d end# your code goes here