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 + 1 + i d -= 1 if d.month == 2 and d.day == 29 and !t1.leap? a += 1 if t1 < d.next_year end b = 0 N.times do |i| d = t0 - i d -= 1 if d.month == 2 and d.day == 29 and !t1.leap? b += 1 if t1 < d.next_year end puts [a, b].minmax * " "