//Taken from: http://p...content-available-to-author-only...e.org/349916#57,61,162,175
//see also http://w...content-available-to-author-only...s.com/forums/showthread.php?t=38143

//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//

#include <stdio.h>

// Global Variables
//These macro define some default information of RTC
#define ORIGINYEAR       1980                  // the begin year
#define MAXYEAR          (ORIGINYEAR + 100)    // the maxium year


//------------------------------------------------------------------------------
//
// Function: IsLeapYear
//
// Local helper function checks if the year is a leap year
//
// Parameters:
//
// Returns:
//      
//
//------------------------------------------------------------------------------
static int IsLeapYear(int Year)
{
    int Leap;

    Leap = 0;
    if ((Year % 4) == 0) {
        Leap = 1;
        if ((Year % 100) == 0) {
            Leap = (Year%400) ? 0 : 1;
        }
    }

    return (Leap);
}


int main(void) {
	
	int days;
	
	scanf("%d",&days);
	
	/*
Фрагмент кода для разбора даты:
вход: days - количество прошедших дней, 
       начиная с 1 января 1980
на выходе: year - год
      days - количество прошедших дней,
       начиная с начала года year
    */
	
	
	int year;
	
	//...

    year = ORIGINYEAR;

    while (days > 365)
    {
        if (IsLeapYear(year))
        {
            if (days > 366)
            {
                days -= 366;
                year += 1;
            }
        }
        else
        {
            days -= 365;
            year += 1;
        }
    }


    
    
    printf("Year is %4d\n",year);
    printf("Days from beginning of year: %d\n", days);
    
    
    
	return 0;
}
