using System; class K { static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); static (int, int, int) Read3() { var a = Read(); return (a[0], a[1], a[2]); } static void Main() => Console.WriteLine(Solve()); static object Solve() { var (y, n, d) = Read3(); var all = IsLeapYear(y + 1) ? 366 : 365; var min = Math.Max(0, n - d); var max = Math.Min(n, all - d); return $"{min} {max}"; } static bool IsLeapYear(int y) { if (y % 400 == 0) return true; if (y % 100 == 0) return false; return y % 4 == 0; } }