A, B, S = gets.chomp.split time = Time.new(2021, 1, 1, A.to_i, B.to_i) offset = 9 - S[4..-1].to_f time -= offset * 3600 puts "%02d:%02d" % [time.hour, time.min]