a,b,c = gets.split.map(&:to_i) a *= 60 c *= 60 * 60 puts -1 if 60*a < b