require "date" Y, N, D = gets.split.map(&:to_i) t0 = DateTime.new(Y, 4, 1, 20, 0, 0) t1 = t0 + D a = 0 N.times do |i| d = t0.prev_year(12) + 1 + i d -= 1 if d.month == 2 and d.day == 29 and !t1.leap? a += 1 if t1 < d.next_year(12) end b = 0 N.times do |i| d = t0.prev_year(11) - i d -= 1 if d.month == 2 and d.day == 29 and !t1.leap? b += 1 if t1 < d.next_year(12) end puts [a, b].minmax * " "