struct dian
{
   int h;
   int x;
};
int Compare(const void*elem1,const void*elem2)
{
    struct dian *p1,*p2;
    p1=(struct dian*)elem1;
    p2=(struct dian*)elem2;
    return (*p2).h-(*p1).h;
}
main()
{
      int n,i,j,k;
      scanf("%d",&n);
      struct dian *d = (struct dian *)malloc(sizeof(struct dian)*(n));
      int *a= (int*)malloc(sizeof(int)*(n));
      for(i=0;i<n;i++)
      a[i]=1;
      for(i=0;i<n;i++)
      {
                        scanf("%d",&d[i].h);
                        d[i].x=i;
      }
      qsort(d,n,sizeof(struct dian),Compare);
      for(i=n-2;i>=0;i--)
      {
              for(j=i+1;j<n;j++)
              {
                           if(d[i].h==d[j].h&&d[i].x>d[j].x)
                           {
                                                            struct dian c;
                                                            c.x=d[i].x;
                                                            d[i].x=d[j].x;
                                                            d[j].x=c.x;
                           }
             }
     }
      for(i=n-2;i>=0;i--)
      {
              for(j=i+1;j<n;j++)
              {
                           if(d[i].x<d[j].x)
                           {
                                    if(a[i]<a[j]+1)
                                       a[i]=a[j]+1;
                           }
             }
     }
      int max=a[0];
      for(k=0;k<n;k++)
      {
                        if(a[k]>max)
                        max=a[k];
       }
      printf("%d",max);
      free(d);
      free(a);
      getchar();
      getchar();
      getchar();
}


int a[26],k,max=1;

void f(int i,int n)
{
	extern int a[26],k,max;
	int j;
	if(i==(k-1))
	{
		if(n>max)
			max=n;
		return ;
	}
	for(j=i+1;j<k;j++)
	{
		if(a[i]>=a[j])
			f(j,n+1);
		else
		{
			if(n>max)
				max=n;
		}
	}
}

int main()
{
	extern int a[26],k,max;
	int i;
	scanf("%d",&k);
	for(i=0;i<k;i++)
		scanf("%d",&a[i]);
	for(i=0;i<k;i++)
		f(i,1);
	printf("%d",max);
	return 0;
}


int count=0,a[25],n,d=0,h,k=0;
void f()
{
	int i,temp=count,temph=h;
	for(i=k;i<n;i++)
	{
		if(a[i]<=h){
		h=a[i];
		k=i+1;count++;
		d=count>d?count:d;
		f();
		count=temp;
		h=temph;
		}
	}
}

void main()
{
	int i,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	h=a[0];for(i=1;i<n;i++)if(a[i]>h)h=a[i];
	f();
	printf("%d",d);
}


int compare(int x,int y)
{
    if( x <= y){
        x=(y+1);
    }
    return x;
}

int main(void)
{

    int i,n,r,a,j;
    scanf("%d",&n);
    int *p=(int *)malloc(n*sizeof(int));
    for(i=0;i!=n;i++){
        scanf("%d",&p[i]);
    }
    int *q=(int *)malloc(n*sizeof(int));
    for(j=0;j!=n;j++)
    {
        q[j] = 1;
        for(r=0;r!=j;r++){
            if(p[j] <= p[r]){
                q[j]=compare(q[j],q[r]);
            }

        }
    }
    int max;
    max=q[0];
    for(a=0;a<n;a++){
        if(q[a]>max)
        max=q[a];
    }
    printf("%d",max);
return 0;
}


int h[30];
int result[30];

int findFirstLess(int num)
{
	int index = 0;
	while(1)
	{
		if(result[index] < num)
			return index;
		index++;
	}
}

int main()
{
	int k, i = 0, r,p, ans;
	scanf("%d ", &k);
	while(1)
	{
		if(i >= k)
			break;
		scanf("%d", h + i);
		i++;
	}
	result[0] = h[0];
	i = 1;
	r = 0;
	while(i < k) // ????????, i.e. ???????
	{
		if(h[i] <= result[r]) // h?????????
			result[++r] = h[i]; //??
		if(h[i] > result[r])
			result[findFirstLess(h[i])] = h[i];
		i++;
	}
//	printf()

	//??????????
/*
	i = 0;
	p = 0;
	ans = 0;
	while(i < k)
	{
		if(h[i] == result[p + 1])
		{
			p++;
			continue;
		}
		if(h[i] == result[p])
			ans++;
		i++;
	}
*/
	printf("%d\n", r+1);

	return 0;
}


/*
 * 1.cpp
 *
 *  Created on: 2011-6-8
 *      Author: 09119
 */
int k;
int high[30];
int ff(int pos,int highflag,int count)
{
	if(pos == k)
		return count;
	if(high[pos] <= highflag)
	{
		int tmp1 = ff(pos+1,high[pos],count+1);
		int tmp2 = ff(pos+1,highflag,count);
		if(tmp1 > tmp2 )
			return tmp1;
		else
			return tmp2;
	}
	else
	{
		return ff(pos+1,highflag,count);
	}
}
int main()
{
	int i;
	cin>>k;
	for(i=0;i<k;i++)
	{
		cin>>high[i];
	}
	int result = ff(0,99999,0);
	cout<<result<<endl;
	return 0;
}


int k; //???
int mis[30];
int maxL =0;
int curH =100000;
int getNum=0;
int cmp(int a, int b)//????
{
     if(a>b) return 0;
     else return 1;
}

void oneState(int id)
{
     if(id >= k)
     {
          if(getNum>maxL)
			  maxL = getNum;
		  return;
     }

    if(mis[id]<=curH)//??
    {
	   int t =curH;
       curH = mis[id];
       getNum++;

		oneState(id+1);

		curH = t;
		getNum--;

	}

	oneState(id+1);

	}

int main()
{
	cin>>k;
	for(int i=0;i<k;i++)
	{
		cin>>mis[i];
	}
    oneState(0);
	cout<<maxL<<endl;

   return 0;
}


int a[25];
int result[25];

int main()
{
	int k;
	cin>>k;
	for(int i = k - 1; i >= 0; i--)
		cin>>a[i];

	result[0] = 1;
	for(int i = 1; i < k; i++)
	{
		int j = i - 1;
		while(j >= 0)
		{
			if(a[j] <= a[i])
			{
				if(result[j] > result[i])
					result[i] = result[j];
			}
			j--;
		}
		result[i]++;
	}

	int t = 0;
	for(int i = 0; i < k; i++)
	{
		if(result[i] > t)
			t = result[i];
	}

	cout<<t;
}


void main()
{
	int y,m,d,a,i,ans;
    for (i=1;i<=5;i++)
    {
    scanf("%d%d%d",&y,&m,&d);

	if (y%4!=0)
	    a=1;
		else if (y%100!=0)
			a=0;
			else if (y%400!=0)
			     a=1;
			     else
			     a=0;
    if (a)
	{
		switch(m)
		{
		  case 1: ans=d; break;
          case 2: ans=31+d; break;
		  case 3: ans=59+d; break;
		  case 4: ans=90+d; break;
		  case 5: ans=120+d; break;
		  case 6: ans=151+d; break;
		  case 7: ans=181+d; break;
		  case 8: ans=212+d; break;
		  case 9: ans=243+d; break;
		  case 10: ans=273+d; break;
		  case 11: ans=304+d; break;
		  case 12: ans=334+d; break;
		}
	}
        else
		{
		  switch(m)
		  {
		    case 1: ans=d; break;
            case 2: ans=31+d; break;
		    case 3: ans=60+d; break;
		    case 4: ans=91+d; break;
		    case 5: ans=121+d; break;
		    case 6: ans=152+d; break;
		    case 7: ans=182+d; break;
		    case 8: ans=213+d; break;
		    case 9: ans=244+d; break;
		    case 10: ans=274+d; break;
		    case 11: ans=305+d; break;
		    case 12: ans=335+d; break;
		  }
		}
	printf("%d\n",ans);
         }
}


int main(int argc, char* argv[])
{
    int year,month,day,a;
    scanf("%d %d %d",&year,&month,&day);
    if(year%4==0&&year%100!=0||year%400==0){
		if(month==1)
			a=day;
		if(month==2)
			a=day+31;
	    if(month==3)
			a=day+60;
        if(month==4)
			a=day+91;
        if(month==5)
			a=day+121;
        if(month==6)
			a=day+152;
        if(month==7)
			a=day+182;
        if(month==8)
			a=day+213;
        if(month==9)
			a=day+244;
        if(month==10)
			a=day+274;
        if(month==11)
			a=day+305;
        if(month==12)
			a=day+335;}
		else
		{
        if(month==1)a=day;
		if(month==2)a=day+31;
	    if(month==3)a=day+59;
        if(month==4)a=day+90;
        if(month==5)a=day+120;
        if(month==6)a=day+151;
        if(month==7)a=day+181;
        if(month==8)a=day+212;
        if(month==9)a=day+243;
        if(month==10)a=day+273;
        if(month==11)a=day+304;
        if(month==12)a=day+334;};
	printf("%d\n",a);
	return 0;
}


main()
{
      int day,month,year,sum,leap;
      scanf("%d%d%d",&year,&month,&day);
      switch(month)
      {
                   case 1:sum=0;break;
                   case 2:sum=31;break;
                   case 3:sum=59;break;
                   case 4:sum=90;break;
                   case 5:sum=120;break;
                   case 6:sum=151;break;
                   case 7:sum=181;break;
                   case 8:sum=212;break;
                   case 9:sum=243;break;
                   case 10:sum=273;break;
                   case 11:sum=304;break;
                   case 12:sum=334;break;
                   default:printf("data error\n");break;
      }
      sum=sum+day;
      if(year%400==0||(year&4==0&&year%100!=0))
      leap=1;
      else
      leap=0;
      if(leap==1&&month>2)
      sum=sum+1;
      printf("%d\n",sum);
      getchar();
      getchar();
}


int main()
{
	int year,month,day;
	scanf("%d %d %d",&year,&month,&day);
	int dmonth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int i=0;
	int sum=0;
	for (i=0;i<month-1;i++){
		sum=sum+dmonth[i];
	}
	if (year%4==0&&year%100!=0||year%400==0){
		if (month>=3){
			sum=sum+day+1;
		}
	}
	else {
		sum=sum+day;
	}
	printf("%d",sum);
	return 0;
}


int X1(int y ,int z)//?????????????????
{
    int j;
    switch (y) //?????????????
    {
      case 1:j = z;break;
      case 2:j = 31 + z;break;
      case 3:j = 59 + z;break;
      case 4:j = 90 + z;break;
      case 5:j = 120 + z;break;
      case 6:j = 151 + z;break;
      case 7:j = 181 + z;break;
      case 8:j = 212 + z;break;
      case 9:j = 243 + z;break;
      case 10:j = 273 + z;break;
      case 11:j = 304 + z;break;
      default:j = 334 + z;break;
    }
    return (j);
}
int X2(int y ,int z)//????????????????
{
    int j;
    switch (y) //?????????????
    {
      case 1:j = z;break;
      case 2:j = 31 + z;break;
      case 3:j = 60 + z;break;
      case 4:j = 91 + z;break;
      case 5:j = 121 + z;break;
      case 6:j = 152 + z;break;
      case 7:j = 182 + z;break;
      case 8:j = 213 + z;break;
      case 9:j = 244 + z;break;
      case 10:j = 274 + z;break;
      case 11:j = 305 + z;break;
      default:j = 335 + z;break;
    }
    return (j);
}
int main()
{
	int y , m, d;
	cin>>y>>m>>d;
	cout<<endl;
	int num;
	if (y%100==0)
	{//?????????
	   if (y%400==0)//???????
	      num=X2(m,d);
	   else  num=X1(m,d);
	}
	else
	{
	   if (y%4==0)//???????
		 num=X2(m,d);
	   else  num=X1(m,d);
	}
	cout<<num<<endl;
	return 0;
}


int main()
{
    int year,month,day;
	int n;
	scanf("%d %d %d",&year,&month,&day);
	if((year%4==0 && year%100!=0)||year%400==0) //????
	{
		switch(month){
		    case 1:
				n=day;
				break;
		    case 2:
				n=31+day;
				break;
			case 3:
				n=60+day;
				break;
			case 4:
				n=91+day;
				break;
			case 5:
				n=121+day;
				break;
			case 6:
				n=152+day;
				break;
			case 7:
				n=182+day;
				break;
			case 8:
				n=213+day;
				break;
			case 9:
				n=244+day;
				break;
			case 10:
				n=274+day;
				break;
            case 11:
				n=305+day;
				break;
			case 12:
				n=335+day;
				break;
		}
	}
	else
	{
		switch(month){
		    case 1:
				n=day;
				break;
		    case 2:
				n=30+day;
				break;
			case 3:
				n=59+day;
				break;
			case 4:
				n=90+day;
				break;
			case 5:
				n=120+day;
				break;
			case 6:
				n=151+day;
				break;
			case 7:
				n=181+day;
				break;
			case 8:
				n=212+day;
				break;
			case 9:
				n=243+day;
				break;
			case 10:
				n=273+day;
				break;
            case 11:
				n=304+day;
				break;
			case 12:
				n=334+day;
				break;
		}
	}
	printf("%d",n);
return 0;
}


int main()
{
	int d,m,y,sum,leap;
	scanf("%d %d %d",&y,&m,&d);
	switch(m)
	{
	case 1:sum=0;break;
	case 2:sum=31;break;
	case 3:sum=59;break;
	case 4:sum=90;break;
	case 5:sum=120;break;
	case 6:sum=151;break;
	case 7:sum=181;break;
	case 8:sum=212;break;
	case 9:sum=243;break;
	case 10:sum=273;break;
	case 11:sum=304;break;
	case 12:sum=334;break;
	default:printf("data error");break;
	}
	sum=sum+d;
	if(y%400==0||(y%4==0&&y%100!=0))
		leap=1;
	else
		leap=0;
	if(leap==1&&m>2)
		sum++;
	printf("%d",sum);
}


int main()
{
	int year,month1,day;
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>year>>month1>>day;
	int i;
	int sum=0;
	if(((year%4==0)&&(year%100!=0))||(year%400==0))
	{
		month[2]=month[2]+1;
		for(i=1;i<month1;i++)
		{
			sum=sum+month[i];
		}
		sum=sum+day;
	}
	else
	{
	for(i=1;i<month1;i++)
		{
			sum=sum+month[i];
		}
		sum=sum+day;
	}

	cout<<sum;
	return 0;

}


int panduan(int(year));
int main()
{
	int sum=0,year,month,day;
	int i;
	int Month1[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int Month2[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	cin>>year>>month>>day;
	if(panduan(year)==1)
	{
		for(i=1;i<month;i++)
			sum += Month1[i];
	    sum += day;
		cout<<sum;
		return 0;
	}
	else
	{
		for(i=1;i<month;i++)
			sum += Month2[i];
	    sum += day;
		cout<<sum;
		return 0;
	}
	return 0;
}
int panduan(int year)
{
	if(year%4==0&&year%100!=0||year%400==0)
		return 1;
	else
		return 0;
}


int shirunnian(int d)
{
	if(d%4==0)
	{
		if(d%100==0)
		{
			if(d%400==0)
				return 1;
			else return 0;
		}
		else return 1;
	}
	else return 0;
}

int dijitian(int a,int b,int c)
{
	int i;
	int sum=0;
	int days=0;
	for(i=0;i<b;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			days+=31;
		else if(i==4||i==6||i==9||i==11)
			days+=30;
		else if(i==2)
		{
			if(shirunnian(a)==1)
			{
				days+=29;
			}
			else if(shirunnian(a)==0)
			{
				days+=28;
			}
		}
	}
	sum=days+c;
	return sum;
}

int main()
{
	int year,month,day,tianshu=0;
	scanf("%d%d%d", &year,&month,&day);
    tianshu=dijitian(year,month,day);
	printf("%d",tianshu);
	return 0;
}


int main()
{

	int y,m,d,s,er;
	scanf("%d %d %d",&y,&m,&d);
	if(y%400==0)
	{
		er=29;
		switch(m)
		{
		case 1:s=d;printf("%d\n",s);break;
	    case 2:s=31+d;printf("%d\n",s);break;
	    case 3:s=31+er+d;printf("%d\n",s);break;
	    case 4:s=31*2+er+d;printf("%d\n",s);break;
	    case 5:s=31*2+er+30+d;printf("%d\n",s);break;
	    case 6:s=31*3+er+30+d;printf("%d\n",s);break;
	    case 7:s=31*3+er+30*2+d;printf("%d\n",s);break;
	    case 8:s=31*4+er+30*2+d;printf("%d\n",s);break;
	    case 9:s=31*5+er+30*2+d;printf("%d\n",s);break;
	    case 10:s=31*5+er+30*3+d;printf("%d\n",s);break;
	    case 11:s=31*6+er+30*3+d;printf("%d\n",s);break;
	    case 12:s=31*6+er+30*4+d;printf("%d\n",s);
		}
	}
	else
	{
		er=28;
		switch(m)
		{
		case 1:s=d;printf("%d\n",s);break;
	    case 2:s=31+d;printf("%d\n",s);break;
	    case 3:s=31+er+d;printf("%d\n",s);break;
	    case 4:s=31*2+er+d;printf("%d\n",s);break;
	    case 5:s=31*2+er+30+d;printf("%d\n",s);break;
	    case 6:s=31*3+er+30+d;printf("%d\n",s);break;
	    case 7:s=31*3+er+30*2+d;printf("%d\n",s);break;
	    case 8:s=31*4+er+30*2+d;printf("%d\n",s);break;
	    case 9:s=31*5+er+30*2+d;printf("%d\n",s);break;
	    case 10:s=31*5+er+30*3+d;printf("%d\n",s);break;
	    case 11:s=31*6+er+30*3+d;printf("%d\n",s);break;
	    case 12:s=31*6+er+30*4+d;printf("%d\n",s);
		}
	}
	return 0;
}


int main()
{
	int days[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int year,month,day;
	int isleapyear;
	scanf("%d%d%d",&year,&month,&day);

	isleapyear=(year%4==0&&year%100!=0)||year%400==0;
	if (isleapyear&& month == 2 && (day < 1 || day > 29))
	{
    		printf("Illegal input.\n");
    		return -1;
	}
	if (isleapyear&& month != 2 && (day < 1 || day > days[month]))
	{
    		printf("Illegal input.\n");
    		return -1;
	}
	if (!isleapyear&& (day < 1 || day > days[month]))
	{
    		printf("Illegal input.\n");
   		 return -1;
	}

	int n=0;
	int i;
	for(i=0;i<month;i++)
		{
		n+=days[i];
		}
	n+=day;
	if(month>2&&isleapyear)
		n++;
	printf("%d",n);
	return 0;
}


int main(int argc, char* argv[])
{
	int year, month, date;
	int m=0,n=0;
	scanf("%d %d %d", &year, &month, &date);
	if (month==1)
	{
		n=date;
	}
	m=m+31;
	if (month==2)
	{
		n=m+date;
	}
	    if ((year%4==0&&year%100!=0)||(year%400==0))
		{
			m=m+29;
		}
		else
		{
			m=m+28;
		}

	if (month==3)
	{
		n=m+date;
	}
	m=m+31;
	if (month==4)
	{
		n=m+date;
	}
	m=m+30;
	if (month==5)
	{
		n=m+date;
	}
	m=m+31;
	if (month==6)
	{
		n=m+date;
	}
	m=m+30;
	if (month==7)
	{
		n=m+date;
	}
	m=m+31;
	if (month==8)
	{
		n=m+date;
	}
	m=m+31;
	if (month==9)
	{
		n=m+date;
	}
	m=m+30;
	if (month==10)
	{
		n=m+date;
	}
	m=m+31;
	if (month==11)
	{
		n=m+date;
	}
	m=m+30;
	if (month==12)
	{
		n=m+date;
	}
	printf("%d\n", n);
	return 0;
}


int main()
{
	int year,month,day;
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&year,&month,&day);
	int i,j;
	int sum=0;
	for(i=1;i<month;i++)
	{
	j=i-1;
	sum=sum+monthday[j];
	}
	sum=sum+day;
	int a;
	a=year%4;
	if(month>2&&(a==0&&year%100!=0||year%400==0))
	{
		sum=sum+1;
	}
	printf("%d",sum);
	return 0;
}


int days_of_month[2][12] = {{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
							{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};

int is_leap_year(int year)
{
	if(year%100!=0 && year%4==0 || year%400==0)
		return 1;
	else
		return 0;
}

int main()
{
	int year, month, day;
	scanf("%d%d%d", &year, &month, &day);
	int index = is_leap_year(year);
	int days = 0;
	for(int i=0; i<month-1; i++)
		days += days_of_month[index][i];
	days += day;
	printf("%d", days);
}


int main(int argc, char* argv[])
{
	int year,month,day;
	int real;
	scanf("%d%d%d",&year,&month,&day);
	if((year%4==0 && year%100!=0) || (year%400==0))
	{
	       if(month==1)
		   {
	           printf("%d",day);
		   }
	       if(month==2)
		   {
	           real=31+day;
		       printf("%d",real);
		   }
	       if(month==3)
		   {
	           real=31+29+day;
		       printf("%d",real);
		   }
	       if(month==4)
		   {
	           real=31+29+31+day;
		       printf("%d",real);
		   }
	       if(month==5)
		   {
	           real=31*2+30+29+day;
		       printf("%d",real);
		   }
	       if(month==6)
		   {
	           real=31*3+30+29+day;
		       printf("%d",real);
		   }
	       if(month==7)
		   {
	           real=31*3+30*2+29+day;
		       printf("%d",real);
		   }
	       if(month==8)
		   {
	           real=31*4+30*2+29+day;
		       printf("%d",real);
		   }
	       if(month==9)
		   {
	           real=31*5+30*2+29+day;
		       printf("%d",real);
		   }
	       if(month==10)
		   {
	           real=31*5+30*3+29+day;
		       printf("%d",real);
		   }
	       if(month==11)
		   {
	           real=31*6+30*3+29+day;
		       printf("%d",real);
		   }
	       if(month==12)
		   {
	           real=31*6+30*4+29+day;
		       printf("%d",real);
		   }

	}
	   else
	   {
	       if(month==1)
		   {
	           printf("%d",day);
		   }
	       if(month==2)
		   {
	           real=31+day;
		       printf("%d",real);
		   }
	       if(month==3)
		   {
	           real=31+28+day;
		       printf("%d",real);
		   }
	       if(month==4)
		   {
	           real=31+28+31+day;
		       printf("%d",real);
		   }
	       if(month==5)
		   {
	           real=31*2+30+28+day;
		       printf("%d",real);
		   }
	       if(month==6)
		   {
	           real=31*3+30+28+day;
		       printf("%d",real);
		   }
	       if(month==7)
		   {
	           real=31*3+30*2+28+day;
		       printf("%d",real);
		   }
	       if(month==8)
		   {
	           real=31*4+30*2+28+day;
		       printf("%d",real);
		   }
	       if(month==9)
		   {
	           real=31*5+30*2+28+day;
		       printf("%d",real);
		   }
	       if(month==10)
		   {
	           real=31*5+30*3+28+day;
		       printf("%d",real);
		   }
	       if(month==11)
		   {
	           real=31*6+30*3+28+day;
		       printf("%d",real);
		   }
	       if(month==12)
		   {
	           real=31*6+30*4+28+day;
		       printf("%d",real);
		   }
	   }
	return 0;
}


int main()
{
	int year,month,day,n;
	scanf("%d%d%d",&year,&month,&day);
	switch(month)
	{
	case 1:
		{
		n=day;
		break;
		}

	case 2:
		{
		n=31+day;
		  break;
		}

	case 3:
		{
		n=59+day;
                  if( (year%4==0&&year%100!=0) || (year%400==0) )
	         {
		    n=n+1;
	         }
                   else
	         {
		    n=n;
                   }

		  break;
		}
	case 4:
		{
		n=90+day;
		  break;
		}
	case 5:
		{
		n=120+day;
		  break;
		}
	case 6:
		{
		n=151+day;
		  break;
		}
	case 7:
		{
		n=181+day;
		  break;
		}
	case 8:
		{
		n=212+day;
		  break;
		}
	case 9:
		{
		n=243+day;
		  break;
		}
	case 10:
		{
		n=273+day;
		  break;
		}
	case 11:
		{
		n=304+day;
		  break;
		}
	case 12:
		{
		n=334+day;
		  break;
		}
	}
	printf("%d\n",n);
         return 0;
}


int Year(int a)
{
	if(a%100==0)
	{
		if(a%400==0)
		{
			return 1;
		}
		else
			return 0;
	}
	else if(a%4==0)
	{
		return 1;
	}
	else
		return 0;
}
int main()
{
	int year,month,day,a[13],i,answer;
	cin >>year>>month>>day;
	for(i=1;i<=12;i++)
	{
		switch(i)
		{
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12:
				a[i]=31;break;
			case 4:
			case 6:
			case 9:
			case 11:
				a[i]=30;break;
			case 2:
				if(Year(year)==1)
				{
					a[i]=29;
					break;
				}
				else
				{
					a[i]=28;
					break;
				}
		}
	}
	answer=0;
	for(i=1;i<month;i++)
	{
		answer+=a[i];
	}
	answer+=day;
	cout <<answer<<endl;
	return 0;
}


int main()
{
	int a,b,c,d,e;
	scanf("%d%d%d",&a,&b,&c);
	if((a%4==0&&a%100!=0)||(a%400==0))
		d=29;
	else
		d=28;
	switch(b){
	case 1:
			e=c;
			break;
	case 2:
			e=31+c;
			break;
	case 3:
			e=31+d+c;
			break;
	case 4:
			e=62+d+c;
			break;
	case 5:
			e=92+d+c;
			break;
	case 6:
			e=123+d+c;
			break;
	case 7:
			e=153+d+c;
			break;
	case 8:
			e=184+d+c;
			break;
	case 9:
			e=215+d+c;
			break;
	case 10:
			e=245+d+c;
			break;
	case 11:
			e=276+d+c;
			break;
	case 12:
			e=306+d+c;
			break;
	}
	printf("%d",e);
	return 0;
}


int main()
{
	struct time
	{
		int year;
		int month;
		int date;
		int dayoftheyear;
	} nn;
    scanf("%d%d%d",&nn.year,&nn.month,&nn.date);
		if(((nn.year%4==0)&&(nn.year%100==0))||(nn.year%400==0))
		{

           switch(nn.month){
		    case 1:
			nn.dayoftheyear=nn.date;
			break;
			case 2:
			nn.dayoftheyear=nn.date+jan;
			break;
			case 3:
			nn.dayoftheyear=nn.date+jan+feb+1;
			break;
			case 4:
			nn.dayoftheyear=nn.date+jan+feb+mar+1;
			break;
			case 5:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+1;
			break;
			case 6:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+1;
			break;
			case 7:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+1;
			break;
			case 8:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+1;
			break;
			case 9:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+1;
			break;
			case 10:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep+1;
			break;
			case 11:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep+oct+1;
			break;
			case 12:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep+oct+nov+1;
			break;

		}
		}
		   else
		   {

            switch(nn.month){
		    case 1:
			nn.dayoftheyear=nn.date;
			break;
			case 2:
			nn.dayoftheyear=nn.date+jan;
			break;
			case 3:
			nn.dayoftheyear=nn.date+jan+feb;
			break;
			case 4:
			nn.dayoftheyear=nn.date+jan+feb+mar;
			break;
			case 5:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr;
			break;
			case 6:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may;
			break;
			case 7:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun;
			break;
			case 8:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul;
			break;
			case 9:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug;
			break;
			case 10:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep;
			break;
			case 11:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep+oct;
			break;
			case 12:
			nn.dayoftheyear=nn.date+jan+feb+mar+apr+may+jun+jul+aug+sep+oct+nov;
			break;

		}
		   }
		printf("%d\n",nn.dayoftheyear);

	return 0;
}


long total;

int run(int n)
{
	if (n%4==0 && n%100!=0)
	{
		return 1;
	}
	if (n%400==0)
	{
		return 1;
	}
	return 0;
}

int main()
{
	int year,month,day;
	int i;
	while (cin>>year>>month>>day)
	{
		total=0;
		if (run(year))
		{

				if (month==1)
				{
					total+=day;
				}
				if (month==2)
				{
					total+=31+day;
				}
				switch (month)
				{
					case 3:total+=60+day;break;
					case 4:total+=91+day;break;
					case 5:total+=121+day;break;
					case 6:total+=152+day;break;
					case 7:total+=182+day;break;
					case 8:total+=213+day;break;
					case 9:total+=244+day;break;
					case 10:total+=274+day;break;
					case 11:total+=305+day;break;
					case 12:total+=335+day;break;
				}
		}
		else
		{
				if (month==1)
				{
					total+=day;
				}
				if (month==2)
				{
					total+=31+day;
				}
				switch (month)
				{
					case 3:total+=59+day;break;
					case 4:total+=90+day;break;
					case 5:total+=120+day;break;
					case 6:total+=151+day;break;
					case 7:total+=181+day;break;
					case 8:total+=212+day;break;
					case 9:total+=243+day;break;
					case 10:total+=273+day;break;
					case 11:total+=304+day;break;
					case 12:total+=334+day;break;
				}
		}
		cout<<total<<endl;
	}
	return 0;
}


int main()
{
	int yy,mm,dd,i,n=0;
	scanf("%d%d%d",&yy,&mm,&dd);
	if(yy%4==0&&yy%100!=0||yy%400==0)
	{
		for(i=1;i<mm;i++)
		{
			switch(i)
			{
			case 1:
					n=n+31;
					break;
			case 2:

					n=n+29;
					break;
			case 3:
					n=n+31;
					break;
			case 4:
					n=n+30;
					break;
			case 5:
					n=n+31;
					break;
			case 6:
					n=n+30;
					break;
			case 7:
					n=n+31;
					break;
			case 8:
					n=n+31;
					break;
			case 9:
					n=n+30;
					break;
			case 10:
					n=n+31;
					break;
			case 11:
					n=n+30;
					break;
			case 12:
					n=n+31;
					break;

			}
		}

			n=n+dd;
			printf("%d",n);

	}

	else
	{
		for(i=1;i<mm;i++)
		{
			switch(i)
			{
			case 1:
					n=n+31;
					break;
			case 2:
					n=n+28;
					break;
			case 3:
					n=n+31;
					break;
			case 4:
					n=n+30;
					break;
			case 5:
					n=n+31;
					break;
			case 6:
					n=n+30;
					break;
			case 7:
					n=n+31;
					break;
			case 8:
					n=n+31;
					break;
			case 9:
					n=n+30;
					break;
			case 10:
					n=n+31;
					break;
			case 11:
					n=n+30;
					break;
			case 12:
					n=n+31;
					break;

			}
		}

			n=n+dd;
			printf("%d",n);

	}

	return 0;
}


int runnian(int a)
{
	if(a%4==0&&a%400==0)
		return 1;
	if(a%4==0&&a%100!=0)
		return 1;
	else return 0;
}
int tian(int nian,int yue,int ri)
{
	int sum=0,i;
	int run[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int feirun[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	if(runnian(nian)==1)
	{
		for(i=0;i<=yue-2;i++)
			sum+=run[i];
		sum+=ri;
	}
	else
	{
		for(i=0;i<=yue-2;i++)
			sum+=feirun[i];
		sum+=ri;
	}
	return sum;
}

int main()
{
	int nian,yue,ri;
	cin>>nian>>yue>>ri;
	cout<<tian(nian,yue,ri)<<endl;
	return 0;
}


int main(int argc, char* argv[])
{
	int year,m,d,result=0;
	scanf ("%d%d%d",&year,&m,&d);
	for (int i=1;i<m;i++){
		if (i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			result+=31;
		else if (i==2){
				if (year%400==0||year%4==0&&year%100!=0)
					result+=29;
				else
					result+=28;
			}
			else
				result+=30;
	}
	result+=d;
	printf ("%d\n",result);
	return 0;
}


// Provided the value of year, month and day,
// what day is it in this year?

//    1. January, 31 days
//    2. February, 28 days, 29 in leap years
//    3. March, 31 days
//    4. April, 30 days
//    5. May, 31 days
//    6. June, 30 days
//    7. July, 31 days
//    8. August, 31 days
//    9. September, 30 days
//    10. October, 31 days
//    11. November, 30 days
//    12. December, 31 days
static int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

// The Gregorian calendar, the current standard calendar in most of the world,
// adds a 29th day to February in all years evenly divisible by 4, except for
// centennial years (those ending in -00), which receive the extra day only if
// they are evenly divisible by 400.
static int isleapyear(int year) {
  return (year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0;
}

int main() {
  int year, month, day;
  int j;

  for(j=0;j<5;j++){
   int n = 0;  // to store the result.
  int i;
    scanf("%d %d %d", &year, &month, &day);

  // Check the input.
  if (isleapyear(year) && month == 2 && (day < 1 || day > 29)) {
    printf("Illegal input.\n");
    return -1;
  }
  if (isleapyear(year) && month != 2 && (day < 1 || day > days[month])) {
    printf("Illegal input.\n");
    return -1;
  }
  if (!isleapyear(year) && (day < 1 || day > days[month])) {
    printf("Illegal input.\n");
    return -1;
  }

  // add days of former months.
  for (i = 1; i < month; i++) {
    n += days[i];
  }
  // add days of this month.
  n += day;
  // check leap year
  if (month > 2 && isleapyear(year))
    n++;

  printf("%d\n", n);
  }
  return 0;
}


// Provided the value of year, month and day,
// what day is it in this year?

//    1. January, 31 days
//    2. February, 28 days, 29 in leap years
//    3. March, 31 days
//    4. April, 30 days
//    5. May, 31 days
//    6. June, 30 days
//    7. July, 31 days
//    8. August, 31 days
//    9. September, 30 days
//    10. October, 31 days
//    11. November, 30 days
//    12. December, 31 days
static int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

// The Gregorian calendar, the current standard calendar in most of the world,
// adds a 29th day to February in all years evenly divisible by 4, except for
// centennial years (those ending in -00), which receive the extra day only if
// they are evenly divisible by 400.
static int isleapyear(int year) {
  return (year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0;
}

int main() {
  int year, month, day;
  scanf("%d %d %d", &year, &month, &day);

  // Check the input.
  if (isleapyear(year) && month == 2 && (day < 1 || day > 29)) {
    printf("Illegal input.\n");
    return -1;
  }
  if (!isleapyear(year) && (day < 1 || day > days[month])) {
    printf("Illegal input.\n");
    return -1;
  }

  int n = 0;  // to store the result.
  int i;
  // add days of former months.
  for (i = 1; i < month; i++) {
    n += days[i];
  }
  // add days of this month.
  n += day;
  // check leap year
  if (isleapyear(year) && month > 2)
    n++;

  printf("%d", n);
}


main(){
	int year,month,day;
	scanf("%d %d %d",&year,&month,&day);
	int i;

	if(year%4==0||year%100==0){
		if(month==1){
			i=day;
		}
		else if(month==2){
			i=(month-1)*31+day;
		}
		else{
			i=(month-1)*31+day-month/2-1;
		}
	}
	else{
		if(month==1){
			i=day;
		}
		else if(month==2){
			i=(month-1)*31+day;
		}
		else{
			i=(month-1)*31+day-month/2-1;
		}
	}

	printf("%d",i);

	return 0;
}


void main()
{
	int a[10], b[10], c[10],n[10],d,i;
	for(i=0;i<5;i++)
	{
	scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	for(i=0;i<5;i++)
	{
	if((a[i]%4==0&&a[i]%100!=0)||a[i]%400==0)
	{
		switch(b[i])
	{
case 1: d=0;break;
case 2: d=31;break;
case 3: d=60;break;
case 4: d=91;break;
case 5: d=121;break;
case 6: d=152;break;
case 7: d=182;break;
case 8: d=213;break;
case 9: d=244;break;
case 10: d=274;break;
case 11: d=305;break;
case 12: d=335;break;
	}
	n[i]=d+c[i];
	printf("%d\n",n[i]);
	}
		else
	{
switch(b[i])
	{
case 1: d=0;break;
case 2: d=31;break;
case 3: d=59;break;
case 4: d=90;break;
case 5: d=120;break;
case 6: d=151;break;
case 7: d=181;break;
case 8: d=212;break;
case 9: d=243;break;
case 10: d=273;break;
case 11: d=304;break;
case 12: d=334;break;
	}
n[i]=d+c[i];
printf("%d\n",n[i]);
		}
}
}


int main(int argc, char* argv[])
{
	int year,month,d;
	int result=0;
    int i;
    int a[12]={31,28,31,30,31,30,31,31,31,31,30,31};
	scanf("%d%d%d",&year,&month,&d);
	if ((year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0){
		a[2]=a[2]+1;
		for(i=1;i<month;i++){
			result+=a[i];
		}
		result+=d;
	}
	else
    	         for(i=1;i<month;i++){
			result+=a[i];
		}
		result+=d;
	printf("%d\n",result);
	return 0;

}


int main()
{
	int j,total=0;
	int year,month,day;
		scanf("%d%d%d",&year,&month,&day);
		for(j=1;j<month;j++)
		{
			if(j==1||j==3||j==5||j==7||j==8||j==10||j==12)
				total=total+31;
			if(j==4||j==6||j==9||j==11)
				total=total+30;
			if(j==2)
			{
				if((year%4==0&&year%100!=0)||year%400==0)
					total=total+29;
				else
					total=total+28;
			}
		}
			total=total+day;
			printf("%d\n",total);
			return 0;

}


int main()
{
    int year, month, date, leap, num = 0;
    int mon[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
    scanf("%d %d %d", &year, &month, &date);

    if (year%100 == 0){
        if (year%400 == 0) leap = 1;
        else leap = 0;
    }
    else {
        if (year%4 == 0) leap = 1;
        else leap = 0;
    }

    int i;
    switch(leap)
    {
        case 1: for ( i = 0; i < month - 1; i++ ){
                    num = num + mon[i];
                }
                if ( month >= 3 ) num = num + date + 1;
                else num = num + date;
                break;
        case 0: for ( i = 0; i < month - 1; i++ ){
                    num = num + mon[i];
                }
                num = num + date;
    }

    printf("%d", num);

    return 0;
}


int main ( )
{
	int nian,yue,ri,tian,i=1;
	for (;i<=5;i=i+1)
	{
	scanf("%d %d %d\n",&nian,&yue,&ri);
	if (nian%4==0&&nian%100!=0||nian%100==0&&nian%400==0)
	{
		switch (yue)
	{
		case 1:tian=0;break;
		case 2:tian=31;break;
        case 3:tian=60;break;
		case 4:tian=91;break;
		case 5:tian=121;break;
		case 6:tian=152;break;
		case 7:tian=182;break;
		case 8:tian=213;break;
		case 9:tian=244;break;
		case 10:tian=274;break;
		case 11:tian=305;break;
		case 12:tian=335;break;
	}
	}
	else
	{
		switch (yue)
	{
		case 1:tian=0;break;
		case 2:tian=31;break;
        case 3:tian=59;break;
		case 4:tian=90;break;
		case 5:tian=120;break;
		case 6:tian=151;break;
		case 7:tian=181;break;
		case 8:tian=212;break;
		case 9:tian=243;break;
		case 10:tian=273;break;
		case 11:tian=304;break;
		case 12:tian=334;break;
	}
	}
	tian=tian+ri;
	printf("%d\n",tian);
	}
         return 0;
}


int main()
{
    int y,m,d,sum,jan=31,feb,mar=31,apr=30,may=31,jun=30,jul=31,aug=31,sep=30,oct=31,nov=30;
    scanf("%d%d%d",&y,&m,&d);
    if((y%400==0)||((y%4==0)&&(y%100!=0)))
    feb=29;
    else feb=28;
    switch (m)
    {
    case 1:sum=d;break;
    case 2:sum=jan+d;break;
    case 3:sum=jan+feb+d;break;
    case 4:sum=jan+feb+mar+d;break;
    case 5:sum=jan+feb+mar+apr+d;break;
    case 6:sum=jan+feb+mar+apr+may+d;break;
    case 7:sum=jan+feb+mar+apr+may+jun+d;break;
    case 8:sum=jan+feb+mar+apr+may+jun+jul+d;break;
    case 9:sum=jan+feb+mar+apr+may+jun+jul+aug+d;break;
    case 10:sum=jan+feb+mar+apr+may+jun+jul+aug+sep+d;break;
    case 11:sum=jan+feb+mar+apr+may+jun+jul+aug+sep+oct+d;break;
    case 12:sum=jan+feb+mar+apr+may+jun+jul+aug+sep+oct+nov+d;break;
    }
    printf("%d",sum);
    return 0;
}


int main()
{
	int year,month,day,days;
	scanf("%d%d%d",&year,&month,&day);
	if(month==1) days=day;
	else if(month==2) days=day+31;
	else if(month==3) days=day+59;
	else if(month==4) days=day+90;
	else if(month==5) days=day+120;
	else if(month==6) days=day+151;
	else if(month==7) days=day+181;
	else if(month==8) days=day+212;
	else if(month==9) days=day+243;
	else if(month==10) days=day+273;
	else if(month==11) days=day+304;
	else if(month==12) days=day+334;
	if(year%100==0,year%400!=0) printf("%d",days);
	else if(year%100!=0,year%4!=0) printf("%d",days);
    else if(year%100!=0,year%4==0)
	{
		if(month>=1,month<=2) printf("%d",days);
		else if(month>2,month<=12) printf("%d",days+1);
	}
	else if(year%400==0)
	{
		if(month>=1,month<=2) printf("%d",days);
		else if(month>2,month<=12) printf("%d",days+1);
	}
}


int main()
{
	int year,month,day;
	int result;
	scanf("%d %d %d",&year,&month,&day);
	result=(month-1)*30+day;
	if((year%4==0&&year%100!=0)||(year%400==0))
	{
       	if(month==2||month==4||month==5)
		{result=result+1;}
		if(month==6||month==7)
		{result=result+2;}
		if(month==8)
		{result=result+3;}
		if(month==9||month==10)
		{result=result+4;}
		if(month==11||month==12)
		{result=result+5;}
	}
	else
	{
		if(month==2)
		{result=result+1;}
		if(month==3)
		{result=result-1;}
		if(month==6||month==7)
		{result=result+1;}
		if(month==8)
		{result=result+2;}
		if(month==9||month==10)
		{result=result+3;}
		if(month==11||month==12)
		{result=result+4;}
	}
	printf("%d",result);
	return 0;
}


int run(int n)
{
	if(n%4==0&&n%100!=0)
		return 1;
	if(n%400==0)
		return 1;
	return 0;
}
int yue(int y,int n)
{
	if(n==1||n==3||n==5||n==7||n==8||n==10||n==12)
		return 31;
	if(run(y)==1&&n==2)
		return 29;
	if(run(y)==0&&n==2)
		return 28;
	return 30;
}
int days(int y,int m,int d)
{
	int k=0;
	for(int i=1;i<m;i++)
		k+=yue(y,i);
	k+=d;
	return k;
}
int main()
{
	int y,m,d;
	scanf("%d %d %d",&y,&m,&d);
	printf("%d",days(y,m,d));
	return 0;
}


int main()
{
	int a,b,c,n;
	scanf("%d %d %d",&a,&b,&c);
	if(a%400==0||(a%4==0&&a%100!=0))
	{
		switch (b){
		case 1:
			{
				n=c;
				break;
			}
        case 2:
			{
				n=31+c;
	break;
			}
        case 3:
			{
				n=60+c;
	break;
			}
        case 4:
			{
				n=91+c;
	break;
			}
        case 5:
			{
				n=121+c;
	break;
			}
        case 6:
			{
				n=152+c;
	break;
			}
        case 7:
			{
				n=182+c;
	break;
			}
        case 8:
			{
				n=213+c;
	break;
			}
        case 9:
			{
				n=244+c;
	break;
			}
        case 10:
			{
				n=274+c;
	break;
			}
        case 11:
			{
				n=305+c;
	break;
			}
        case 12:
			{
				n=335+c;
	break;
			}
		}

	}
	else
	{
      switch (b){
		case 1:
			{
				n=c;
	break;
			}
        case 2:
			{
				n=31+c;
	break;
			}
        case 3:
			{
				n=59+c;
	break;
			}
        case 4:
			{
				n=90+c;
	break;
			}
        case 5:
			{
				n=120+c;
	break;
			}
        case 6:
			{
				n=151+c;
	break;
			}
        case 7:
			{
				n=181+c;
	break;
			}
        case 8:
			{
				n=212+c;
	break;
			}
        case 9:
			{
				n=243+c;
	break;
			}
        case 10:
			{
				n=273+c;
	break;
			}
        case 11:
			{
				n=304+c;
	break;
			}
        case 12:
			{
				n=334+c;
	break;
			}
		}
	}
	printf("%d",n);
	return 0;
	}


int main()
{
	int y, m, d, day = 0;
	scanf("%d%d%d", &y, &m, &d);
	if (y%4 == 0 && y%100 != 0 && y % 400 == 0)
		switch (m)
	{
		case 12 : day = day + 30;
		case 11 : day = day + 31;
		case 10 : day = day + 30;
		case 9 : day = day + 31;
		case 8 : day = day + 31;
		case 7 : day = day + 30;
		case 6 : day = day + 31;
		case 5 : day = day + 30;
		case 4 : day = day + 31;
		case 3 : day = day + 29;
		case 2 : day = day + 31;
		case 1 : day = day + d;
	}
	else
				switch (m)
	{
		case 12 : day = day + 30;
		case 11 : day = day + 31;
		case 10 : day = day + 30;
		case 9 : day = day + 31;
		case 8 : day = day + 31;
		case 7 : day = day + 30;
		case 6 : day = day + 31;
		case 5 : day = day + 30;
		case 4 : day = day + 31;
		case 3 : day = day + 28;
		case 2 : day = day + 31;
		case 1 : day = day + d;
	}
	printf("%d", day);

}


int isRN(int year)
{
	int result;
	if((year%4==0&&year%100!=0)||year%400==0)
		result=1;
	else
		result=0;
	return result;
}
void main()
{
	int year,month,day;
	int i;
	int sum=0;
	scanf("%d%d%d",&year,&month,&day);
	for(i=1;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			sum+=31;
		else if(i==4||i==6||i==9||i==11)
			sum+=30;
		else
		{
			if(isRN(year)==1)
				sum+=29;
			else
				sum+=28;
		}
	}
	sum+=day;
	printf("%d",sum);
}


int main()
{
	int year, month, date, February, day;
	scanf("%d %d %d", &year, &month, &date);
	if ((year%4==0 && year%100!=0) || (year%400 == 0))
		February = 29;
	else
		February = 28;
	if (month==1)
		day =  date;
	if (month==2)
		day = 31  + date;
	if (month == 3)
		day = 31 + February  + date;
	if (month == 4)
		day = 31 + February + 31  + date;
	if (month == 5)
		day = 31 + February + 31 + 30  + date;
	if (month == 6)
		day = 31 + February + 31 + 30 + 31 + date;
	if (month == 7)
		day = 31 + February + 31 + 30 + 31 + 30  + date;
	if (month == 8)
		day = 31 + February + 31 + 30 + 31 + 30 + 31  + date;
	if (month == 9)
		day = 31 + February + 31 + 30 + 31 + 30 + 31 + 31 +date;
	if (month == 10)
		day = 31 + February + 31 + 30 + 31 + 30 + 31 + 31 + 30+date;
	if (month == 11)
        day = 31 + February + 31 + 30 + 31 + 30 + 31 + 31 + 30+31+date;
	if (month == 12)
        day = 31 + February + 31 + 30 + 31 + 30 + 31 + 31 + 30+31+30+date;
	printf("%d\n", day);
	return 0;
}


int main(int argc, char* argv[])
{
int year,month,day,a,rank;
scanf("%d%d%d",&year,&month,&day);
if((year%4==0)&&(year%100!=0)||(year%400==0))
{
a=1;}
else {a=0;}
if(month==1){rank=day;}
if(month==2){rank=31+day;}
if(month==3){rank=59+a+day;}
if(month==4){rank=90+a+day;}
if(month==5){rank=120+a+day;}
if(month==6){rank=151+a+day;}
if(month==7){rank=181+a+day;}
if(month==8){rank=212+a+day;}
if(month==9){rank=243+a+day;}
if(month==10){rank=273+a+day;}
if(month==11){rank=304+a+day;}
if(month==12){rank=334+a+day;}
printf("%d",rank);
return 0;
}


int main()
{
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if((a%100!=0&&a/4==0)||a%400==0)
	{
      switch(b)
	  {
	  case 1:printf("%d",c); break;
	  case 2:printf("%d",d=31+c);break;
      case 3:printf("%d",d=60+c);break;
	  case 4:printf("%d",d=91+c);break;
	  case 5:printf("%d",d=121+c);break;
	  case 6:printf("%d",d=152+c);break;
	  case 7:printf("%d",d=182+c);break;
	  case 8:printf("%d",d=213+c);break;
	  case 9:printf("%d",d=244+c);break;
	  case 10:printf("%d",d=274+c);break;
	  case 11:printf("%d",d=305+c);break;
	  case 12:printf("%d",d=335+c);break;
	  }
	}
	else
	{
		switch(b)
		{
        case 1:printf("%d",c);break;
		case 2:printf("%d",d=31+c);break;
		case 3:printf("%d",d=59+c);break;
		case 4:printf("%d",d=90+c);break;
		case 5:printf("%d",d=120+c);break;
		case 6:printf("%d",d=151+c);break;
		case 7:printf("%d",d=181+c);break;
		case 8:printf("%d",d=212+c);break;
		case 9:printf("%d",d=243+c);break;
		case 10:printf("%d",d=273+c);break;
		case 11:printf("%d",d=304+c);break;
		case 12:printf("%d",d=334+c);break;
		}
	}
 return 0;
}


int main()
{
	int year,month,day,b,i;
	for(i=1;i<=5;++i)
	{
	int count(int month,int year,int day);
	scanf("%d %d %d",&year,&month,&day);
	b=count(month,year,day);
	printf("%d\n",b);
	}
	scanf("%d",&b);
	return 0;
}

    int count(int month,int year,int day)
	{
		int a;
		if((year%4==0&&year%100!=0)||year%400==0)
		{
			switch(month)
			{
			case(1):
			a=day;break;
			case(2):
			a=31+day;break;
			case(3):
			a=60+day;break;
			case(4):
			a=91+day;break;
			case(5):
				a=121+day;break;
			case(6):
				a=152+day;break;
			case(7):
				a=182+day;break;
			case(8):
				a=213+day;break;
			case(9):
				a=244+day;break;
			case(10):
				a=274+day;break;
			case(11):
				a=305+day;break;
			case(12):
				a=335+day;break;
			}
		}
		else
		{
			switch(month)
			{
			case(1):
			a=day;break;
			case(2):
			a=31+day;break;
			case(3):
			a=59+day;break;
			case(4):
			a=90+day;break;
			case(5):
				a=120+day;break;
			case(6):
				a=151+day;break;
			case(7):
				a=181+day;break;
			case(8):
				a=212+day;break;
			case(9):
				a=243+day;break;
			case(10):
				a=273+day;break;
			case(11):
				a=304+day;break;
			case(12):
				a=334+day;break;
			}
		}
		return(a);
	}


int leap(int year){
	if((year%4==0 && year%100!=0) || year%400==0)
		return 1;
	else{
		return 0;
	}
}
void main(){
	int year,month,day;
	int days,i;
	days=0;
	scanf("%d%d%d",&year,&month,&day);
	for(i=1;i<month;i++){
		if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)
			days+=31;
		if(i==4 || i==6 || i==9 || i==11)
			days+=30;
		if(i==2){
			if(leap(year))
				days+=29;
			else{
				days+=28;
			}
		}
	}
	days+=day;
	printf("%d\n",days);
}


void main()
{
  int y,m,d,t,i;
  for(i=1;i<=5;)
  {
    scanf("%d %d %d",&y,&m,&d);
    if ((y%4==0&&y%100!=0)||(y%400==0))
    {
      switch(m)
      {
        case 1: t=d;break;
        case 2: t=d+31;break;
        case 3: t=d+60;break;
        case 4: t=d+91;break;
        case 5: t=d+121;break;
        case 6: t=d+152;break;
        case 7: t=d+182;break;
        case 8: t=d+213;break;
        case 9: t=d+244;break;
        case 10: t=d+274;break;
        case 11: t=d+305;break;
        case 12: t=d+335;break;
      }
    }
    else
    {
      switch(m)
      {
        case 1: t=d;break;
        case 2: t=d+31;break;
        case 3: t=d+59;break;
        case 4: t=d+90;break;
        case 5: t=d+120;break;
        case 6: t=d+151;break;
        case 7: t=d+181;break;
        case 8: t=d+212;break;
        case 9: t=d+243;break;
        case 10: t=d+273;break;
        case 11: t=d+304;break;
        case 12: t=d+334;break;
      }
    }
    printf("%d\n",t);
    i++;
  }
}


int main(int argc, char* argv[])
{
    int d[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int year,month,day,i,days=0;
	scanf("%d%d%d",&year,&month,&day);
    for(i=1;i<month;i++)
	{
		days=days+d[i-1];
	}
	days=days+day;
	if((year%4==0||year%400==0)&&month>2)
		days=days++;
	printf("%d",days);
}


void main()
{
 int i;
 int sum_day(int,int);
 int leap(int year);
 int year[5],month[5],day[5],days[5];
 for(i=0;i<5;i++)
 scanf("%d%d%d",&year[i],&month[i],&day[i]);
 for(i=0;i<5;i++)
 {days[i]=sum_day(month[i],day[i]);
 if(leap(year[i])&&month[i]>=3)
  days[i]=days[i]+1;
 printf("%d\n",days[i]);}
}
   int sum_day(int month,int day)
   {int day_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int i;
    for(i=1;i<month;i++)
      day+=day_tab[i];
    return(day);
   }

  int leap(int year)
   {int leap;
    leap=year%4==0&&year%100!=0||year%400==0;
    return(leap);
   }


int main()
{
	int a,b,c,d;
	scanf("%d%d%d",&a,&b,&c);
	if((a%4==0&&a%100!=0)||a%400==0)
		switch(b){
		    case 1:
			    d=c;
			    break;
		    case 2:
			    d=31+c;
			    break;
		    case 3:
			    d=60+c;
			    break;
		    case 4:
			    d=91+c;
			    break;
		    case 5:
   			    d=121+c;
                break;
		    case 6:
			    d=152+c;
			    break;
		    case 7:
			    d=182+c;
			    break;
		    case 8:
			    d=213+c;
			    break;
		    case 9:
			    d=244+c;
			    break;
		    case 10:
			    d=274+c;
			    break;
		    case 11:
			    d=305+c;
			    break;
		    case 12:
			    d=335+c;
			    break;
		    default :
			    d=0;
	}
	else
		switch(b){
			case 1:
				d=c;
				break;
			case 2:
				d=31+c;
				break;
			case 3:
				d=59+c;
				break;
			case 4:
				d=90+c;
				break;
			case 5:
   				d=120+c;
                break;
			case 6:
				d=151+c;
				break;
			case 7:
				d=181+c;
				break;
			case 8:
				d=212+c;
				break;
			case 9:
				d=243+c;
				break;
			case 10:
				d=273+c;
				break;
			case 11:
				d=304+c;
				break;
			case 12:
				d=334+c;
				break;
			default :
	            d=0;
	}
    printf("%d\n",d);
	return 0;
}


void main()
{
	struct date
	{
		int year;
		int month;
		int day;
		int days;
	}date1;
	scanf("%d %d %d",&date1.year,&date1.month,&date1.day);
    int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	date1.days=0;
	int i;
	if (date1.month>1)
	{
		for ( i=0;i<=date1.month-2;i++)
		{
			date1.days=date1.days+b[i];
		}
		date1.days=date1.days+date1.day;
	}
	else
	{
		date1.days=date1.day;
	}
	printf("%d",date1.days);
}


int main(int argc, char* argv[])
{
	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);
	if(year%4!=0||(year%100==0&&year%400!=0))
	{if (month==1)
		printf("%d",day);
	else if(month==2)
		printf("%d",day+31);
    else if(month==3)
	    printf("%d",day+59);
	else if(month==4)
		printf("%d",day+90);
    else if(month==5)
		printf("%d",day+120);
    else if(month==6)
	    printf("%d",day+151);
	else if(month==7)
		printf("%d",day+181);
    else if(month==8)
		printf("%d",day+212);
    else if(month==9)
	    printf("%d",day+242);
	else if(month==10)
		printf("%d",day+273);
    else if(month==11)
		printf("%d",day+304);
    else if(month==12)
		printf("%d",day+334);
}
	else
{if (month==1)
		printf("%d",day);
	else if(month==2)
		printf("%d",day+31);
    else if(month==3)
	    printf("%d",day+59+1);
	else if(month==4)
		printf("%d",day+90+1);
    else if(month==5)
		printf("%d",day+120+1);
    else if(month==6)
	    printf("%d",day+151+1);
	else if(month==7)
		printf("%d",day+182);
    else if(month==8)
		printf("%d",day+213);
    else if(month==9)
	    printf("%d",day+243);
	else if(month==10)
		printf("%d",day+274);
    else if(month==11)
		printf("%d",day+305);
    else if(month==12)
		printf("%d",day+335);
}

	return 0;
}


int main()
{
	int  a,b,c,D;
	scanf("%d %d %d",&a,&b,&c);
	if(((a%4==0)&&(a%100!=0))||(a%400==0))
	{
		switch(b)
		{
		case 1:
			D = c;
			break;
		case 2:
			D = c +31;
			break;

        case 3:
			D = c +60;
			break;
        case 4:
			D = c + 91;
			break;
        case 5:
			D = c + 121;
			break;
        case 6:
			D = c + 152;
			break;
        case 7:
			D = c + 182;
			break;
        case 8:
			D = c + 213;
			break;
        case 9:
			D = c + 244;
			break;
        case 10:
			D = c + 274;
			break;
        case 11:
			D = c + 305;
			break;
        case 12:
			D = c + 335;
			break;

		}
		printf("%d",D);

	}
	else
	{
		switch(b)
		{
		case 1:
			D = c;
			break;
		case 2:
			D = c +31;
			break;

        case 3:
			D = c +60-1;
			break;
        case 4:
			D = c + 91-1;
			break;
        case 5:
			D = c + 121-1;
			break;
        case 6:
			D = c + 152-1;
			break;
        case 7:
			D = c + 182-1;
			break;
        case 8:
			D = c + 213-1;
			break;
        case 9:
			D = c + 244-1;
			break;
        case 10:
			D = c + 274-1;
			break;
        case 11:
			D = c + 305-1;
			break;
        case 12:
			D = c + 335-1;
			break;
		}

		printf("%d",D);

	}

	return 0;
}


static int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

static int isleapyear(int year)
 {
  return (year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0;
}

int main() {
  int year, month, day;
  scanf("%d %d %d", &year, &month, &day);

  int n = 0;
  int i;
  for (i = 1; i < month; i++)
  {
    n += days[i];
  }

  n += day;

  if (month > 2 && isleapyear(year))
    n++;

  printf("%d", n);
}


int RunNian(int y)
     {
        int result ;
         if (y%4==0 && y%100!=0|| y%400==0)
         {
                    result=1;
         }
         else
         {
            result=0;
         }
         return result;
     }

int DiJiTian(int y,int m,int d)
     {
         int result=0;
          for (int i=1;i<m;i++)
          {
              if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
                {
                  result+=31;
                }
              else if(i==4||i==6||i==9||i==11)
                {
                  result+=30;
                }
              else if(i==2)
                {
                   if(RunNian(y))
                     {
                      result+=29;
                     }
                    else
                      {
                       result+=28;
                      }
                }
          }

          result+= d;
          return result;
     }

int main()
{

     int y2,m2,d2,a,e;
     int T=0;

       scanf("%d%d%d",&y2,&m2,&d2);

          T+= DiJiTian(y2,m2,d2);
           printf ("%d\n",T);
return 0;
}


int main()
{
	int y,m,d,r;
	int c(int y,int m,int d);
	scanf("%d %d %d",&y,&m,&d);
	r=c(y,m,d);
	printf("%d",r);
}

int run(int y)
{
	if (y%400==0) return 1;
	else if (y%100==0) return 0;
		else if (y%4==0) return 1;
	return 0;
}

int c(int y,int m,int d)
{
	int i,total=0,r=0;
	for (i=1;i<m;i++)
		switch (i)
	{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:{r=r+31;break;}
		case 4:
		case 6:
		case 9:
		case 11:{r=r+30;break;}
		case 2:{
				if (run(y))
					r=r+29;
			   else r=r+28;
			   break;}
	}
	r=r+d;
	return (r);
}


int main()
{
	int year,a,b,m,n;
	scanf("%d%d%d",&year,&a,&b);
	if ((year%4==0&&year%100!=0)||(year%400==0))
	{
		switch(a)
		{
		case 0:
		case 1: m=0;break;
		case 2: m=1;break;
		case 3: m=0;break;
		case 4: m=1;break;
		case 5: m=1;break;
		case 6: m=2;break;
		case 7: m=2;break;
		case 8: m=3;break;
		case 9: m=4;break;
		case 10:m=4;break;
		case 11:m=5;break;
		case 12:m=5;break;
		}
		n=30*(a-1)+m+b;
	}
	else
	{
		switch(a)
		{
		case 0:
                  case 1: m=0;break;
		case 2: m=1;break;
		case 3: m=-1;break;
		case 4: m=0;break;
		case 5: m=0;break;
		case 6: m=1;break;
		case 7: m=1;break;
		case 8: m=2;break;
		case 9: m=3;break;
		case 10:m=3;break;
		case 11:m=4;break;
		case 12:m=4;break;
		}
		n=30*(a-1)+m+b;
	}
	printf("%d\n",n);
	return 0;
}


int main()
{
	int year,month,day,a,all,m1[5],m2[5],m3[5],i;
	for(i=0;i<=4;i++)
	scanf("%d%d%d",&m1[i],&m2[i],&m3[i]);
	for(i=0;i<=4;i++)
	{
		year=m1[i];month=m2[i];day=m3[i];
	if((year%4==0&&year%100!=0)||(year%400==0))
	{
		switch(month)
		{
		case 1:a=366;break;
		case 2:a=335;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		all=366-a+day;

	}
	else
	{
		switch(month)
		{
		case 1:a=365;break;
		case 2:a=334;break;
		case 3:a=306;break;
		case 4:a=275;break;
		case 5:a=245;break;
		case 6:a=214;break;
		case 7:a=184;break;
		case 8:a=153;break;
		case 9:a=122;break;
		case 10:a=92;break;
		case 11:a=61;break;
		case 12:a=31;break;
		}
		all=365-a+day;

	}
	printf("%d\n",all);
	}
	return 0;
}


void main()
{
	int sum_day(int,int);
	int leap(int year);
	int year,month,day,days;
	scanf("%d%d%d",&year,&month,&day);
	days=sum_day(month,day);
	if(leap(year)&&month>=3)
		days=days+1;
	printf("%d",days);
}
int sum_day(int month,int day)
{
	int day_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int i;
	for(i=1;i<month;i++)
		day+=day_tab[i];
	return(day);
}
int leap(int year)
{
	int leap;
	leap=year%3==0&&year%100!=0||year%400==0;
	return(leap);
}


main()
{
    int year,month,day,sum=0;
    int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    scanf("%d %d %d",&year,&month,&day);
    if(((year%4==0)&&(year%100!=0))||(year%400==0))          // when this year is a leap year.
    {
        if(month>2)    // when >=3 month
        {
              sum=sum+29+31;
              for(int k=3;k<month;k++)
              {
                  sum=sum+d[k];
              }
              sum=sum+day;
        }
        else if(month==2)
        {
            sum=31+day;
        }
        else
        {
            sum=day;
        }

    }
    else                // when this year is not a leap year.
    {
        if(month>2)    // when >=3 month
        {
              sum=sum+28+31;
              for(int k=3;k<month;k++)
              {
                  sum=sum+d[k];
              }
              sum=sum+day;
        }
        else if(month==2)
        {
            sum=31+day;
        }
        else
        {
            sum=day;
        }
    }
    printf("%d",sum);
    getchar();
    getchar();
    getchar();
}


int main()
{
    int y,m,d;
    int t;
    scanf("%d %d %d",&y,&m,&d);
    if(y%400==0||(y%4==0&&y%100!=0))
    {
      switch(m)
      {
             case 1:t=0;break;
             case 2:t=31;break;
             case 3:t=60;break;
             case 4:t=91;break;
             case 5:t=121;break;
             case 6:t=152;break;
             case 7:t=182;break;
             case 8:t=213;break;
             case 9:t=244;break;
             case 10:t=274;break;
             case 11:t=305;break;
             case 12:t=335;
      }
    }
    else
    {
      switch(m)
      {
             case 1:t=0;break;
             case 2:t=31;break;
             case 3:t=59;break;
             case 4:t=90;break;
             case 5:t=120;break;
             case 6:t=151;break;
             case 7:t=181;break;
             case 8:t=212;break;
             case 9:t=243;break;
             case 10:t=273;break;
             case 11:t=304;break;
             case 12:t=334;
      }
    }
    t+=d;
    printf("%d",t);
    return 0;
}


int main()
{
	int year, month, day;
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d", &year, &month, &day);
	int i;
	int sum=0;
	for(i=1; i<month; i++)
	{
		sum=sum+monthday[i-1];
	}
	sum=sum+day;
	int a;
	a=year%4;
	if(month>2 && (a==0 && year%100!=0 || year%400==0))
	{
		sum=sum+1;
	}
	printf("%d", sum);
	return 0;
}


int mon( int n){
	int day ;
	switch(n){
		case 1 : day = 31 ; break ;
		case 2 : day = 28 ; break ;
		case 3 : day = 31 ; break ;
		case 4 : day = 30 ; break ;
		case 5 : day = 31 ; break ;
		case 6 : day = 30 ; break ;
		case 7 : day = 31 ; break ;
		case 8 : day = 31 ; break ;
		case 9 : day = 30 ; break ;
		case 10: day = 31 ; break ;
		case 11: day = 30 ; break ;
		case 12: day = 31 ; break ;
	}
	return(day);
}
int run(int year){
	int p ;
	if( year % 400 == 0 ) p = 1 ;
	else if( ( year % 100 != 0 ) && ( year % 4 == 0 ) ) p = 1 ;
	else p = 0 ;
	return (p) ;
}

int main(){
	int year , month , date , i , n = 0 ;
	scanf("%d%d%d" , &year , &month , &date );
	for (i = 1 ; i <= month - 1 ; i++){
		n = n + mon(i) ;
	}
	n = n + date ;
	if ( run(year) == 1 ) n = n + 1 ;
	else n = n ;
	printf("%d" , n);

	return(0);
}


int main()
{
	int year,month,date;
	int sum=0;
	scanf("%d%d%d",&year,&month,&date);
	int temp;
	if(year%4!=0)
		{
		temp=28;//not
		}
		else if(year%100!=0)
		{
			temp=29;//yes
		}
		else if(year%400!=0)
		{
			temp=28;//not
		}
		else
		{
			temp=29;//yes
		}//???????
		int a[12]={31,temp,31,30,31,30,31,31,30,31,30,31};
		int i;
		for(i=0;i<month-1;i++)
		{
			sum+=a[i];
		}
		sum+=date;
		printf("%d",sum);
		return 0;
}


int main()
{
    int y,m,d,n;
    scanf ("%d %d %d",&y,&m,&d);
    if (y%4==0&&y%100!=0||y%400==0)
    {
           switch(m)
           {
           case 1:printf("%d",d);break;
           case 2:printf("%d",31+d);break;
           case 3:printf("%d",60+d);break;
           case 4:printf("%d",91+d);break;
           case 5:printf("%d",121+d);break;
           case 6:printf("%d",152+d);break;
           case 7:printf("%d",182+d);break;
           case 8:printf("%d",213+d);break;
           case 9:printf("%d",244+d);break;
           case 10:printf("%d",274+d);break;
           case 11:printf("%d",305+d);break;
           case 12:printf("%d",335+d);break;
           }
    }
    else
        {
           switch(m)
           {
           case 1:printf("%d",d);break;
           case 2:printf("%d",31+d);break;
           case 3:printf("%d",59+d);break;
           case 4:printf("%d",90+d);break;
           case 5:printf("%d",120+d);break;
           case 6:printf("%d",151+d);break;
           case 7:printf("%d",181+d);break;
           case 8:printf("%d",212+d);break;
           case 9:printf("%d",243+d);break;
           case 10:printf("%d",273+d);break;
           case 11:printf("%d",304+d);break;
           case 12:printf("%d",334+d);break;
           }
    }

    }


void main()
{
	int year,month,day;
	int feb,i,n=0;

	scanf("%d%d%d",&year,&month,&day);

	if (year%4!=0)
		feb=28;
	else
	{
		if (year%100!=0)
			feb=29;
		else
		{
			if (year%400==0)
				feb=29;
			else
				feb=28;
		}
	}

	for (i=1;i<month;i++)
	{
		if (i==2 )
			n=n+feb;
		else
		{
			if (i==4||i==6||i==9||i==11)
				n=n+30;
			else
				n=n+31;
		}
	}

	n=n+day;

	printf("%d",n);

}


int main(int argc, char* argv[])
{
	int year,month,day;
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&year,&month,&day);
	int i;
	int sum=0;
	 for(i=1;i<month;i++){
        sum=sum+monthday[i-1];
	}
	sum=sum+day;
     int a;
	 a=year%4;
	if(month>2 && a==0){
		sum=sum+1;
	}

	printf("%d",sum);
	return 0;
}


  int   day_month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
  int   sum_day(int   month,int   day)
  {   int   i;
      for(i=0;i<month;i++)
      day=day+day_month[i];
      return(day);
    }
  int   leap(int   year)
  {   int   leap;
      leap=year%4==0   &&   year%100!=0   ||   year%400==0;
      return(leap);
    }
  int main()
  {   int   year,month,day,days,a;

      for(a=1;a<=5;a++)
      {scanf("%d%d%d",&year,&month,&day);

      days=sum_day(month,day);
      if(leap(year)   &&   month>=3)
          days=days+1;
      printf("%d\n",days);}

  return 0;
  }


int main()
{
	int a,b,c,i,sum;
	scanf("%d%d%d",&a,&b,&c);
	sum=0;
	for(i=1;i<b;i++)
	{
		switch(i)
		{
		case 1:
			sum+=31;
			break;
		case 2:
			if(a%400==0||(a%100!=0)&&(a%4==0))
			{
				sum+=29;
			}
			else
			{
				sum+=28;
			}
			break;
		case 3:
			sum+=31;
			break;
		case 4:
			sum+=30;
			break;
		case 5:
			sum+=31;
			break;
		case 6:
			sum+=30;
			break;
		case 7:
			sum+=31;
			break;
		case 8:
			sum+=31;
			break;
		case 9:
			sum+=30;
			break;
		case 10:
			sum+=31;
			break;
		case 11:
			sum+=30;
			break;
		case 12:
			sum+=31;
			break;
		}
	}
	sum+=c;
	printf("%d\n",sum);
	return 0;
}


int main(){
	int y,m,d,n;
    scanf("%d %d %d", &y, &m, &d);
	if ((y%100!=0&&y%4==0)||(y%400==0))
	{
switch(m){
case 1:n=d;break;
case 2:n=31+d;break;
case 3:n=60+d;break;
case 4:n=91+d;break;
case 5:n=121+d;break;
case 6:n=152+d;break;
case 7:n=182+d;break;
case 8:n=213+d;break;
case 9:n=244+d;break;
case 10:n=274+d;break;
case 11:n=305+d;break;
default:n=335+d;
	}
	}
	else
	{
switch(m){
case 1:n=d;break;
case 2:n=31+d;break;
case 3:n=59+d;break;
case 4:n=90+d;break;
case 5:n=120+d;break;
case 6:n=151+d;break;
case 7:n=181+d;break;
case 8:n=212+d;break;
case 9:n=243+d;break;
case 10:n=273+d;break;
case 11:n=304+d;break;
default:n=334+d;
}
	}
	printf("%d",n);
	return 0;
}


int main ()
{
	int y,m,d,k,leap=0,i,sum=0;
	cin >>y>>m>>d;
	if ((y%4==0&&y%100!=0)||y%400==0)
		leap=1;
	for (i=1;i<m;i++)
	{
		switch (i)
		{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			k=31;
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			k=30;
			break;
		case 2: if (leap==1)
					k=29;
				else k=28;
				break;
		}
		sum+=k;
	}
	cout <<sum+d;
	return 0;
}


static int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

static int isleapyear(int year) {
	return (year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0;
}

int main() {
	int year, month, day;
	int n = 0;  // to store the result.
	int i;

	scanf("%d %d %d", &year, &month, &day);

	// add days of former months.
	for (i = 1; i < month; i++)
		n = n + days[i];
	// add days of this month.
	n = n + day;
	// check leap year
	if (month > 2 && isleapyear(year))
		n++;

	printf("%d\n", n);
	return 0;
}


int main()
{
	int month,date,n=0,i,year,p;
	scanf("%d %d %d",&year,&month,&date);
	if(year%400==0||(year%100!=0&&year%4==0))
		p=29;
	else
		p=28;
	for(i=1;i<month;i++)
	{
		switch (i)
		{
		case 1:
			n+=31;
			break;
		case 2:
			n+=p;
			break;
		case 3:
			n+=31;
			break;
		case 4:
			n+=30;
			break;
		case 5:
			n+=31;
			break;
		case 6:
			n+=30;
			break;
		case 7:
			n+=31;
			break;
		case 8:
			n+=31;
			break;
		case 9:
			n+=30;
			break;
		case 10:
			n+=31;
			break;
		case 11:
			n+=30;
			break;
		}
	}
	n+=date;
	printf("%d\n",n);
	return 0;
}


int main(){
	int a,b,c,y;
	scanf("%d\t%d\t%d",&a,&b,&c);
	switch(b) {
		case 1:
			y=c;
		    break;
		case 2:
			y=31+c;
			break;
		case 3:
			y=59+c;
			break;
		case 4:
			y=90+c;
			break;
		case 5:
			y=120+c;
			break;
		case 6:
			y=151+c;
			break;
		case 7:
			y=181+c;
			break;
		case 8:
			y=212+c;
			break;
		case 9:
			y=243+c;
			break;
		case 10:
			y=273+c;
			break;
		case 11:
			y=304+c;
			break;
		case 12:
			y=334+c;

	}
	printf("\n%d",y);
	return 0;
}


int main()
{
	int i,year,month,day,date=0;
	scanf("%d%d%d",&year,&month,&day);
	for (i=1;i<month;i++)
	{
		if (i==4 ||i==6 ||i==9 ||i==11)
			date=date+30;
		else
		{
			if (i==2)
			{
				if (year%100!=0 && year%4==0 || year%400==0)
					date=date+29;
				else
					date=date+28;
			}
			else
				date=date+31;
		}
	}
	date =date+day;
	printf("%d\n",date);
	return 0;
}


int main()
{
	int y,m,d,num;
	scanf ("%d %d %d",&y,&m,&d);
	switch (m)
	{
	case 1:num=d;break;
	case 2:num=31+d;break;
	case 3:num=59+d;break;
	case 4:num=90+d;break;
	case 5:num=120+d;break;
	case 6:num=151+d;break;
	case 7:num=181+d;break;
	case 8:num=212+d;break;
	case 9:num=243+d;break;
	case 10:num=273+d;break;
	case 11:num=304+d;break;
	case 12:num=334+d;break;
	}
	if (((y%4==0&&y%100!=0)||(y%400==0))&&(m>2))
		num=num+1;
         printf("%d\n",num);
	return 0;
}


int main()
{
	int Day1[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int Day2[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	int year,month,day;
	int sumday=0;
	int i,j;

	cin >> year >> month >> day;
	if((year%400==0)||(year%4==0&&year%100!=0))
		j=1;
	else
		j=0;
	if(j==1)
	{
	     if(month==1)
		 cout << day << endl;
        	if(month>1)
	      {
		     for(i=0;i<month-1;i++)
			 {sumday=sumday+Day2[i];}
	        	sumday=sumday+day;
		     cout << sumday << endl;
	      }
	}
			if(j==0)
			{

	               if(month==1)
		          cout << day << endl;
        	        if(month>1)
	              {
		              for(i=0;i<month-1;i++)
					  {sumday=sumday+Day1[i];}
	                	sumday=sumday+day;
		              cout << sumday << endl;
	              }

			}
	return 0;
}


int main()
{
	int a,b,c;
	scanf("%d %d %d", &a,&b,&c);
	if (((a%4==0) && (a%100!=0))||(a%400==0)){
		switch (b){
		case 1: {printf("%d", c);break;}
		case 2: {printf("%d", c+31);break;}
		case 3: {printf("%d", c+60);break;}
		case 4: {printf("%d", c+91);break;}
		case 5: {printf("%d", c+121);break;}
		case 6: {printf("%d", c+152);break;}
		case 7: {printf("%d", c+182);break;}
		case 8: {printf("%d", c+213);break;}
		case 9: {printf("%d", c+243);break;}
		case 10: {printf("%d", c+273);break;}
		case 11: {printf("%d", c+305);break;}
		case 12: {printf("%d", c+335);}
		}
	}
	else {
		switch (b){
		case 1: {printf("%d", c);break;}
		case 2: {printf("%d", c+31);break;}
		case 3: {printf("%d", c+59);break;}
		case 4: {printf("%d", c+90);break;}
		case 5: {printf("%d", c+120);break;}
		case 6: {printf("%d", c+151);break;}
		case 7: {printf("%d", c+181);break;}
		case 8: {printf("%d", c+212);break;}
		case 9: {printf("%d", c+243);break;}
		case 10: {printf("%d", c+273);break;}
		case 11: {printf("%d", c+304);break;}
		case 12: {printf("%d", c+334);}
		}
	}
	return 0;
}


int isRunNian(int year){
	int result;
	if(year%400 == 0 ||(year%4==0 && year%100!=0)){
		result = 1;
	} else{
		result = 0;
	}
      return result;
}

int DiJiTian(int year, int month, int day){
	int result = 0;
	for(int i = 1; i < month; i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			result += 31;
		} else if (i == 4 || i ==6 || i == 9 || i==11){
			result += 30;
		} else if(i == 2){
			if(isRunNian(year)){
				result += 29;
			} else {
				result += 28;
			}
		}
	}
	result += day;
	return result;
}
int main()
{
    int year,month,day,Y;
	scanf("%d%d%d",&year,&month,&day);
	Y=DiJiTian(year,month,day);
	printf("%d",Y);
	return 0;
}


int main()
{
	int year,month,day;
	int result;
	scanf("%d %d %d",&year,&month,&day);
	result=(month-1)*30+day;
	if(month==1)
	{printf("%d",result);}
	else
	{
		if(month==2||month==4||month==5)
		{result=result+1;}
	    if(month==6||month==7)
		{result=result+2;}
	    if(month==8)
		{result=result+3;}
    	if(month==9||month==10)
		{result=result+4;}
	    if(month==11||month==12)
		{result=result+5;}
    	if((year%4==0&&year%100!=0)||(year%400==0))
		{	printf("%d",result);}
    	else
		{printf("%d",result-1);}
	}
	return 0;
}


int run(int nian)
{
	if (nian%400==0)
		return 1;
	else
		if (nian%100==0)
			return 0;
		else
			if (nian%4==0)
				return 1;
			else
				return 0;
}

int mon(int m,int n)
{
	switch (m)
	{
	case 1:
	case 3:
	case 5:
	case 7:
	case 8:
	case 10:
		return 31;
	case 4:
	case 6:
	case 9:
	case 11:
		return 30;
	default:
		if (run(n))
			return 29;
		else
			return 28;
	}
}

int main()
{
	int year,month,day,date,i;
	scanf("%d %d %d",&year,&month,&day);
	date=0;
	for (i=1;i<month;i++)
		date=date+mon(i,year);
	date=date+day;
	printf("%d",date);
	return 0;
}


int main(){
	int year,month,day,x;
	int a2;
	scanf("%d %d %d",&year,&month,&day);
	if(year%4==0&&year%100!=0)
	{a2=29;}
	else
	{a2=28;}

	switch(month){
	case 1:
		x=day;
		printf("%d",x);
		break;
	case 2:
		x=a1+day;
		printf("%d",x);
		break;
    case 3:
		x=a1+a2+day;
		printf("%d",x);
		break;
    case 4:
		printf("%d",x);
        x=a1+a2+a3+day;
		break;
    case 5:
		x=a1+a2+a3+a4+day;
		printf("%d",x);
		break;
    case 6:
		x=a1+a2+a3+a4+a5+day;
		printf("%d",x);
        break;
    case 7:
		x=a1+a2+a3+a4+a5+a6+day;
		printf("%d",x);
		break;
    case 8:
		x=a1+a2+a3+a4+a5+a6+a7+day;
		printf("%d",x);
		break;
    case 9:
		x=a1+a2+a3+a4+a5+a6+a7+a8+day;
		printf("%d",x);
		break;
    case 10:
		x=a1+a2+a3+a4+a5+a6+a7+a8+a9+day;
		printf("%d",x);
		break;
    case 11:
		x=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+day;
		printf("%d",x);
		break;
    case 12:
		x=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+day;
		printf("%d",x);
		break;
	}

	return 0;
}


int main()
{
int nian,yue,ri,leap,sum;
scanf("%d%d%d",&nian,&yue,&ri);
switch(yue)
{
case 1:sum=0;
break;
case 2:sum=31;
break;
case 3:sum=59;
break;
case 4:sum=90;
break;
case 5:sum=120;
break;
case 6:sum=151;
break;
case 7:sum=181;
break;
case 8:sum=212;
break;
case 9:sum=243;
break;
case 10:sum=273;
break;
case 11:sum=304;
break;
case 12:sum=334;
break;

}
sum=sum+ri;
if((nian%400==0) ||(nian%4==0 && nian%100!=0 ))
leap=1;
else
leap=0;
if(leap==1 && nian>3&&yue>2)
sum++;
cout <<sum<<endl;

return 0;
}


int main(){
int year,mouth,day,n;
scanf("%d%d%d",&year,&mouth,&day);
if(year%4==0){
switch(mouth){
case 1:n=day;printf("%d",n);break;
case 2:n= 31+day;printf("%d",n);break;
case 3:n=60+day;printf("%d",n);break;
case 4:n=91+day;printf("%d",n);break;
case 5:n=121+day;printf("%d",n);break;
case 6:n=152+day;printf("%d",n);break;
case 7:n=182+day;printf("%d",n);break;
case 8:n=213+day;printf("%d",n);break;
case 9:n=244+day;printf("%d",n);break;
case 10:n=274+day;printf("%d",n);break;
case 11:n=305+day;printf("%d",n);break;
case 12:n=335+day;printf("%d",n);break;}}
else{
switch(mouth){
case 1:n=day;printf("%d",n);break;
case 2:n=31+day;printf("%d",n);break;
case 3:n=59+day;printf("%d",n);break;
case 4:n=90+day;printf("%d",n);break;
case 5:n=120+day;printf("%d",n);break;
case 6:n=151+day;printf("%d",n);break;
case 7:n=181+day;printf("%d",n);break;
case 8:n=212+day;printf("%d",n);break;
case 9:n=243+day;printf("%d",n);break;
case 10:n=273+day;printf("%d",n);break;
case 11:n=304+day;printf("%d",n);break;
case 12:n=334+day;printf("%d",n);break;}}
return 0;
}


int main()
{
	int t=0;
	int monthday[13]={0,31,28+t,31,30,31,30,31,31,30,31,30,31};

	int year,month,day;
	scanf("%d%d%d",&year,&month,&day);

	if(year%4 == 0 && year%100 !=0 || year%400 == 0) t=1;

	int summonth=0;
	int sum=0;

	int i;
	for(i=0;i<month;i++) summonth+=monthday[i];
	sum=summonth+day;
	printf("%d",sum);

    return 0;

}


struct
{
	int year;
	int month;
	int day;
}date;
main()
{
	int days;
	scanf("%d%d%d",&date.year,&date.month,&date.day);
	switch(date.month)
	{
	case 1:days=date.day;      break;
	case 2:days=date.day+31;   break;
	case 3:days=date.day+59;   break;
	case 4:days=date.day+90;   break;
	case 5:days=date.day+120;  break;
	case 6:days=date.day+151;  break;
	case 7:days=date.day+181;  break;
	case 8:days=date.day+212;  break;
	case 9:days=date.day+243;  break;
	case 10:days=date.day+273;  break;
	case 11:days=date.day+304;  break;
	case 12:days=date.day+334;  break;
	}
	if ((date.year%4==0&&date.year%100!=0||date.year%400==0)&&date.month>=3)days+=1;
	printf("%d",days);
	return 0;
}


void main()
{
	int year,month,day,total;
	int i;
	scanf("%d%d%d",&year,&month,&day);
	total=0;
	for(i=1;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
			total=total+31;
		}
		if(i==4||i==6||i==9||i==11)
		{
			total=total+30;
		}
		if(i==2)
		{
			if(year%4==0&&year%100!=0||year%400==0)
			{
				total=total+29;
			}
			else
			{
				total=total+28;
			}
		}
	}
	total=total+day;
    printf("%d",total);
}


int main()
{
    int check(int a);
    int count(int x[], int w, int y);
    int year, month, day;
    scanf("%d%d%d", &year, &month, &day);

    int k;
    int sum;
    k=check(year);
    if(k==1)
    {
           int days1[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
           sum=count(days1, month, day);
           printf("%d", sum);
    }
    else
    {
          int days2[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
          sum=count(days2, month, day);
           printf("%d", sum);
    }

    return 0;
}

    int check(int a)
    {
        int b,c,d;
        b = a%4;
        c = a%100;
        d = a%400;
        if (b!=0)
        {
             return 1;
        }
        else if(c==0&&d!=0)
        {
             return 1;
        }
        else return 0;

    }

     int count(int x[], int w, int y)
     {
         int sum=0;
         int i;
         for(i=1;i<w;i++)
         {
                          sum=sum+x[i];
         }
         sum=sum+y;
         return sum;
     }


int main(int argc, char* argv[])
{
	int year,month,day,total,i;
	scanf("%d%d%d",&year,&month,&day);
	total=0;
	for(i=0;i<month;i++)
	{
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
			total=total+31;
		}
		if(i==4||i==6||i==9||i==11)
		{
			total=total+30;
		}
		if(i==2)
		{
	       if((year%4==0&&year%100!=0)||year%400==0)
			   total=total+29;
		   else total=total+28;
		}
	}
	total=total+day;
	printf("%d",total);
	return 0;
}


int main()
{
	int y1, m, d, no;
	scanf("%d %d %d",&y1,&m,&d);
	no=0;
	if (y1%4==0){
		if (y1%400==0){
			switch(m)
			{
			case 1:no=d;break;
			case 2:no=d+31;break;
			case 3:no=d+60;break;
			case 4:no=d+91;break;
			case 5:no=d+121;break;
			case 6:no=d+152;break;
			case 7:no=d+182;break;
			case 8:no=d+213;break;
			case 9:no=d+243;break;
			case 10:no=d+274;break;
			case 11:no=d+304;break;
			case 12:no=d+335;break;
			}
		}
		else
		{
			if (y1%100==0){
				switch(m)
				{
				case 1:no=d;break;
				case 2:no=d+31;break;
				case 3:no=d+59;break;
				case 4:no=d+90;break;
				case 5:no=d+120;break;
				case 6:no=d+151;break;
				case 7:no=d+181;break;
				case 8:no=d+212;break;
				case 9:no=d+243;break;
				case 10:no=d+273;break;
				case 11:no=d+304;break;
				case 12:no=d+334;break;
				}
			}
			else
			{
				switch(m)
				{
				case 1:no=d;break;
				case 2:no=d+31;break;
				case 3:no=d+60;break;
				case 4:no=d+91;break;
				case 5:no=d+121;break;
				case 6:no=d+152;break;
				case 7:no=d+182;break;
				case 8:no=d+213;break;
				case 9:no=d+243;break;
				case 10:no=d+274;break;
				case 11:no=d+304;break;
				case 12:no=d+335;break;
				}
			}
		}
	}
	else
	{
		switch(m)
		{
		case 1:no=d;break;
		case 2:no=d+31;break;
		case 3:no=d+59;break;
		case 4:no=d+90;break;
		case 5:no=d+120;break;
		case 6:no=d+151;break;
		case 7:no=d+181;break;
		case 8:no=d+212;break;
		case 9:no=d+243;break;
		case 10:no=d+273;break;
		case 11:no=d+304;break;
		case 12:no=d+334;break;
		}

	}
printf("%d",no);
return 0;
}


int isRunNian(int year){
	int result;
	if(year%400==0||year%4==0&&year%100!=0){
		result=1;
	}else{
		result=0;
	}
	return result;
}
int main(){

		int year,month,day;
		int result=0;

		scanf("%d%d%d",&year,&month,&day);

	for(int i=1;i<month;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
			result+=31;
		}else if(i==4||i==6||i==9||i==11){
			result+=30;
		}else if(i==2){
			if(isRunNian(year)){
				result+=29;
			}else{
				result+=28;
			}
		}
	}
	result+=day;
	printf("%d",result);
	return 0;
}


int main(int argc, char* argv[])
{
	int year,month,day,which;
	scanf("%d%d%d",&year,&month,&day);
	which=day;
	month--;
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		if(year%4!=0)which+=28;
		else if(year%100==0&&year%400!=0)which+=28;
		else which+=29;
		month--;
	}
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		which+=30;
		month--;
	}
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		which+=30;
		month--;
	}
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		which+=30;
		month--;
	}
	if(month>0){
		which+=31;
		month--;
	}
	if(month>0){
		which+=30;
		month--;
	}
    printf("%d",which);
	return 0;

}


int main(){
	int a,b,c,i,j,m=0,n,r=0;
	scanf("%d%d%d",&a,&b,&c);
    if (((a%4==0)&&(a%100!=0))||(a%400==0))
		r=1;
	if (r==1)
		switch(b){
			case 2:
				m=31;
				break;
			case 3:
				m=60;
				break;
			case 4:
				m=91;
				break;
			case 5:
				m=121;
				break;
			case 6:
				m=152;
				break;
			case 7:
				m=182;
				break;
			case 8:
				m=213;
				break;
			case 9:
				m=244;
				break;
			case 10:
				m=274;
				break;
			case 11:
				m=305;
				break;
			case 12:
				m=335;
				break;
	}
	else switch(b){
			case 2:
				m=31;
				break;
			case 3:
				m=59;
				break;
			case 4:
				m=90;
				break;
			case 5:
				m=120;
				break;
			case 6:
				m=151;
				break;
			case 7:
				m=181;
				break;
			case 8:
				m=212;
				break;
			case 9:
				m=243;
				break;
			case 10:
				m=273;
				break;
			case 11:
				m=304;
				break;
			case 12:
				m=334;
				break;
	}
	n=m+c;
	printf("%d",n);
	return 0;
}


static int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static int isleapyear(int year)
{
  return (year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0;
}

int main()
{
  int year, month, day;
  int z=1;
  while (z<=5)
  {
  scanf("%d %d %d", &year, &month, &day);
  int n = 0;
  int i;
  for (i = 1; i < month; i++)
  {
    n =n+ days[i];
  }
  n =n+ day;
  if (month > 2 && isleapyear(year))
  n++;
  printf("%d\n",n);
  z++;
  }
}


int main(int argc, char* argv[])
{
	int year,month,day;
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d%d%d",&year,&month,&day);
	int i;
	int sum=0;
	for(i=1;i<month;i++){
		sum=sum+monthday[i-1];
	}
	sum=sum+day;
	int a;
	a=year%4;
	if(month>2&&(a==0&&year%100!=0||year%400==0)){
		sum=sum+1;
	}
	printf("%d",sum);
	return 0;
}


int main(int argc, char* argv[])
{
	int year,month,day,date;
	int a,b,c,e,g,h,j;
	int d,f,i,k;

    a=c=e=g=h=j=31;
    d=f=i=k=30;

	scanf("%d%d%d",&year,&month,&date);

	if((year%4!=0)||(year%100==0&&year%400!=0))
		b=28;
	else
		b=29;

	switch(month){
	case 1:day=date;break;
	case 2:day=a+date;break;
	case 3:day=a+b+date;break;
	case 4:day=a+b+c+date;break;
	case 5:day=a+b+c+d+date;break;
	case 6:day=a+b+c+d+e+date;break;
	case 7:day=a+b+c+d+e+f+date;break;
	case 8:day=a+b+c+d+e+f+g+date;break;
	case 9:day=a+b+c+d+e+f+g+h+date;break;
	case 10:day=a+b+c+d+e+f+g+h+i+date;break;
	case 11:day=a+b+c+d+e+f+g+h+i+j+date;break;
	case 12:day=a+b+c+d+e+f+g+h+i+j+k+date;break;}

	printf("%d\n",day);
	return 0;
}


int main()
{
int year[5],month[5],day[5],m,tianshu,i;
for(i=0;i<=4;i++)
{scanf("%d%d%d",&year[i],&month[i],&day[i]);}
for(i=0;i<=4;i++)
{switch(month[i])
        {case 1:m=0;break;
	case 2:m=31;break;
	case 3:m=59;break;
        case 4:m=90;break;
	case 5:m=120;break;
	case 6:m=151;break;
	case 7:m=181;break;
	case 8:m=212;break;
	case 9:m=243;break;
	case 10:m=273;break;
	case 11:m=304;break;
	case 12:m=334;break;}
        if((year[i]%400==0)||(year[i]%4==0&&year[i]%100!=0))
	      if (m>31)m=m+1;
tianshu=m+day[i];
printf("%d\n",tianshu);}
return 0;
}


int main()
{
	int year;
	short month,day,result=0,i=1;
	char odd;
	while(i<=5)
	{
		scanf("%d%hd%hd",&year,&month,&day);
		odd=year%400==0||year%4==0&&year%100!=0?1:0;
		switch(month)
		{
			case 12:result+=30;
			case 11:result+=31;
			case 10:result+=30;
			case 9: result+=31;
			case 8: result+=31;
			case 7: result+=30;
			case 6: result+=31;
			case 5: result+=30;
			case 4: result+=31;
			case 3: result+=28;
			case 2: result+=31;
			case 1:	;
		}
		if(month>=3)	result+=odd;
		result+=day;
		printf("%hd\n",result);
		result=0;
		i++;
	}
	return(0);
}


int main()
{
	int i,year,month,data,days=0;
	scanf("%d%d%d",&year,&month,&data);
	days=data;
	if(month==1)
	{
		days=days;
	}
	else
	{
		for(i=1;i < month;i++)
        {
			if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
			days=days+31;
			else
			if(i==4||i==6||i==9||i==11)
			days=days+30;
		    else
		    if((year%4==0&&year%100!=0)||(year%400==0))
			days=days+29;
			else days=days+28;
		} days=days;
	}
	printf("%d",days);
	return 0;
}


int main()
{
	int w,s,i,year,month,day;
	int ymd[5][3];
	int num[5];
	for(i=0;i<5;i++)
	{
		scanf("%d %d %d\n",&year,&month,&day);
		ymd[i][0]=year;
		ymd[i][1]=month;
		ymd[i][2]=day;
	}
	for(i=0;i<5;i++)
	{
		year=ymd[i][0];
		month=ymd[i][1];
		day=ymd[i][2];
		w=(year%4==0&&year%100!=0)||year%400!=0;
		switch(month)
		{
        case 1:s=0;break;
		case 2:s=31;break;
		case 3:s=59;break;
		case 4:s=90;break;
		case 5:s=120;break;
		case 6:s=151;break;
		case 7:s=181;break;
		case 8:s=212;break;
		case 9:s=243;break;
		case 10:s=273;break;
		case 11:s=304;break;
		case 12:s=334;break;
		}
		if(w==0&&month>2)
		{
			s=s+1;
		}
	    num[i]=s+day;
	}
	printf("%d\n%d\n%d\n%d\n%d\n",num[0],num[1],num[2],num[3],num[4]);
}


int main(int argc, char* argv[])
{
	int y,m,d;//y=year,m=month,d=day
	scanf("%d%d%d",&y,&m,&d);
	if(y%100==0&&y%40==0||y%100!=0&&y%4==0)//leap year,29 days in Feb
		switch (m)
	{
		    case 1: printf("%d\n",d);break;
			case 2: printf("%d\n",d+31);break;
			case 3: printf("%d\n",d+60);break;
			case 4: printf("%d\n",d+91);break;
			case 5: printf("%d\n",d+121);break;
			case 6: printf("%d\n",d+152);break;
			case 7: printf("%d\n",d+182);break;
			case 8: printf("%d\n",d+213);break;
			case 9: printf("%d\n",d+244);break;
			case 10: printf("%d\n",d+274);break;
			case 11: printf("%d\n",d+305);break;
			case 12:printf("%d\n",d+335);break;

	}
	else
		switch (m)
	{
            case 1: printf("%d\n",d);break;
			case 2: printf("%d\n",d+31);break;
			case 3: printf("%d\n",d+59);break;
			case 4: printf("%d\n",d+90);break;
			case 5: printf("%d\n",d+120);break;
			case 6: printf("%d\n",d+151);break;
			case 7: printf("%d\n",d+181);break;
			case 8: printf("%d\n",d+212);break;
			case 9: printf("%d\n",d+243);break;
			case 10: printf("%d\n",d+273);break;
			case 11: printf("%d\n",d+304);break;
			case 12:printf("%d\n",d+334);break;
	}
	return 0;
}


int main()
{
	int A,B,C,d,z,leap,i;
	i=1;
while(i<=5)
	{
scanf("%d %d %d\n",&A,&B,&C);
	if(A%4==0)
	{
		if(A%100==0)
		{
			if(A%400==0)
				leap=1;
			else
				leap=0;
		}
		else
			leap=1;
	}
	else
	leap=0;
	if(leap)
	{
		switch(B)
		{
		case 1:d=0;break;
			case 2:d=31;break;
			case 3:d=60;break;
            case 4:d=91;break;
            case 5:d=121;break;
			case 6:d=152;break;
			case 7:d=182;break;
			case 8:d=213;break;
			case 9:d=244;break;
			case 10:d=274;break;
			case 11:d=305;break;
			case 12:d=335;break;
		}
		z=d+C;}
	else
	{
	switch(B)
		{
		case 1:d=0;break;
			case 2:d=31;break;
			case 3:d=59;break;
            case 4:d=90;break;
            case 5:d=120;break;
			case 6:d=151;break;
			case 7:d=181;break;
			case 8:d=212;break;
			case 9:d=243;break;
			case 10:d=273;break;
			case 11:d=304;break;
			case 12:d=334;break;
		}
		z=d+C;}
	printf("%d\n",z);
	i=i+1;
	}
	return 0;
}


int	check(int year)
{
	if((year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0)))
	{return 1;}
	else
	{return 0;}
}
int main()
{
	int	year, month, day, date = 0;
	cin >> year;
	cin >> month;
	cin >> day;
	int	m[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

	int	i;
	for (i = 1; i < month; i ++)
	{
		date = date + m[i];
		if(i == 2)
		{
			date = date + check(year);
		}
	}
	date = date + day;

	cout << date << endl;
return 0;
}


int main()
{
	int year,month,day,flag;
	int daytal,tal;
	cin>>year>>month>>day;
	if(year%400==0||(year%4==0)&&(year%100!=0))
		flag=0;
	else
		flag=1;
	switch(month)
	{
	case 1:
		daytal=0;
		break;
	case 2:
		daytal=31;
		break;
	case 3:
		daytal=60;
		break;
	case 4:
		daytal=91;
		break;
	case 5:
		daytal=121;
		break;
	case 6:
		daytal=152;
		break;
	case 7:
		daytal=182;
		break;
	case 8:
		daytal=213;
		break;
	case 9:
		daytal=244;
		break;
	case 10:
		daytal=274;
		break;
	case 11:
		daytal=305;
		break;
	case 12:
		daytal=335;
		break;
	}
	if(month<2)
		flag=0;
	tal=daytal+day-flag;
	cout<<tal<<endl;
	return 0;
}


void main()
{
	int year,month,day,num=0;
	scanf("%d%d%d",&year,&month,&day);
	if(year%4!=0 || (year%100==0 && year/400!=0) )
	{
		switch(month-1)
		{
			case 11:num+=30;
			case 10:num+=31;
			case 9:num+=30;
			case 8:num+=31;
			case 7:num+=31;
			case 6:num+=30;
			case 5:num+=31;
			case 4:num+=30;
			case 3:num+=31;
			case 2:num+=28;
			case 1:num+=31;
			case 0:;break;
		}
		num+=day;
	}
	else
	{
		switch(month-1)
		{
			case 11:num+=30;
			case 10:num+=31;
			case 9:num+=30;
			case 8:num+=31;
			case 7:num+=31;
			case 6:num+=30;
			case 5:num+=31;
			case 4:num+=30;
			case 3:num+=31;
			case 2:num+=29;
			case 1:num+=31;
			case 0:;break;
		}
		num+=day;
	}
	printf("%d\n",num);
}


int main()
{
	int i,year,month,day,sum=0,months[50],msum=0;

	months[1]=31;
	months[2];
	months[3]=31;
	months[4]=30;
	months[5]=31;
	months[6]=30;
	months[7]=31;
	months[8]=31;
	months[9]=30;
	months[10]=31;
	months[11]=30;
	months[12]=31;

	scanf("%d%d%d",&year,&month,&day);
	if(year%4==0)
	{
		if(year%100!=0)
		{
			if(year%400==0)
			{
				months[2]=29;
			}
			else
			{
				months[2]=28;
			}
		}
		else
		{
			if(year%400==0)
			{
				months[2]=29;
			}
			else
			{
				months[2]=28;
			}
		}
	}
	else
	{
		months[2]=28;
	}
	for(i=1;i<month;i++)
	{
		msum=msum+months[i];
	}
	sum=msum+day;
	printf("%d",sum);
	return 0;
}


int main(int argc, char* argv[])
{
	int n=0;
	int year,month,day;
	scanf("%d %d %d",&year,&month,&day);
	if(month==1)n=n+day;
	else if(month==2)n=n+31+day;
	else if(month==3)n=n+59+day;
    else if(month==4)n=n+90+day;
    else if(month==5)n=n+120+day;
    else if(month==6)n=n+151+day;
    else if(month==7)n=n+181+day;
    else if(month==8)n=n+212+day;
    else if(month==9)n=n+243+day;
    else if(month==10)n=n+273+day;
    else if(month==11)n=n+304+day;
	else{n=n+334+day;}
	if( (( (year%4==0)&&(year%100!=0) ) ||(year%400==0))&&(month>2))n=n+1;
	printf("%d",n);
	return 0;
}


int main()
{
	int year,month,date,sum;
	int mon[PI];
	mon[1]=mon[3]=mon[5]=mon[7]=mon[8]=mon[10]=mon[12]=31;
	mon[4]=mon[6]=mon[9]=mon[11]=30;
	sum=0;

	scanf("%d %d %d",&year,&month,&date);
	if (year%4==0&&year%100!=0||year%400==0)
	{
		mon[2]=29;
	}
	else
	{
		mon[2]=28;
	}

	int i;
	for (i=1;i<month;i++)
	{
		sum+=mon[i];
	}
	sum+=date;
	printf("%d",sum);

	return 0;
}


main()
{
         int year,month,day;
         scanf("%d %d %d",&year,&month,&day);
         if (year%400==0)
         {
            if(month==1)
            printf("%d",day);
            if(month==2)
             printf("%d",day+31);
            if(month==3)
             printf("%d",day+60);
            if(month==4)
             printf("%d",day+91);
            if(month==5)
             printf("%d",day+121);
            if(month==6)
             printf("%d",day+152);
            if(month==7)
             printf("%d",day+182);
            if(month==8)
              printf("%d",day+213);
            if(month==9)
             printf("%d",day+244);
            if(month==10)
             printf("%d",day+274);
            if(month==11)
             printf("%d",day+305);
            if(month==12)
            printf("%d",day+335);
         }
         else if(year%4==0&&year%100!=0)
         {
            if(month==1)
            printf("%d",day);
            if(month==2)
             printf("%d",day+31);
            if(month==3)
             printf("%d",day+60);
            if(month==4)
             printf("%d",day+91);
            if(month==5)
             printf("%d",day+121);
            if(month==6)
             printf("%d",day+152);
            if(month==7)
             printf("%d",day+182);
            if(month==8)
              printf("%d",day+213);
            if(month==9)
             printf("%d",day+244);
            if(month==10)
             printf("%d",day+274);
            if(month==11)
             printf("%d",day+305);
            if(month==12)
            printf("%d",day+335);
         }
           else
         {
             if(month==1)
            printf("%d",day);
            if(month==2)
             printf("%d",day+31);
            if(month==3)
             printf("%d",day+59);
            if(month==4)
             printf("%d",day+90);
            if(month==5)
             printf("%d",day+120);
            if(month==6)
             printf("%d",day+151);
            if(month==7)
             printf("%d",day+181);
            if(month==8)
              printf("%d",day+212);
            if(month==9)
             printf("%d",day+243);
            if(month==10)
             printf("%d",day+273);
            if(month==11)
             printf("%d",day+304);
            if(month==12)
            printf("%d",day+334);
         }

}


void main()
{
	int year,mounth,day,count=0,t=0;
	scanf("%d%d%d",&year,&mounth,&day);
	if(year%400==0||(year%4==0&&year%100!=0))
	{
		count=1;
	}
	else count=0;
	if(count==1)
	{
		switch(mounth)
		{
		case 1: t=day; break;
		case 2: t=31+day; break;
		case 3: t=60+day;break;
		case 4: t=91+day;break;
		case 5: t=121+day;break;
		case 6: t=152+day;break;
		case 7: t=182+day;break;
		case 8: t=213+day;break;
		case 9: t=244+day;break;
		case 10: t=274+day;break;
		case 11: t=305+day;break;
		case 12: t=335+day;break;

		}
	}
	if(count==0)
	{
		switch(mounth)
		{
		case 1: t=day; break;
		case 2: t=31+day; break;
		case 3: t=59+day;break;
		case 4: t=90+day;break;
		case 5: t=120+day;break;
		case 6: t=151+day;break;
		case 7: t=181+day;break;
		case 8: t=212+day;break;
		case 9: t=243+day;break;
		case 10: t=273+day;break;
		case 11: t=304+day;break;
		case 12: t=334+day;break;
		}
	}
	printf("%d",t);

}


int Runnian(int y);
int main(){
	int y,m,d,count=0;
	int i;
	scanf("%d %d %d",&y,&m,&d);
	for(i=1;i<m;i++){
		if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)
			count+=31;
		else if(i==4 || i==6 || i==9 || i==11)
			count+=30;
		else if(i==2){
			if(Runnian(y))
				count+=29;
			else
				count+=28;
		}
	}
	count+=d;
	printf("%d\n",count);
	return 0;
}
int Runnian(int y){
	int result;
	if(y%400==0 || (y%4==0 && y%100!=0))
		result=1;
	else
		result=0;
	return result;
}


int GetMonthDays(int year,int month);
int CheckLeap(int year);//????
main()
{
      int year,month,day=1,s=0,i;
      scanf("%d%d%d",&year,&month,&day);
      for(i=1;i<month;i++)
      {
         s+=GetMonthDays(year,i);
      }
      s+=day;
      printf("%d",s);
}

int GetMonthDays(int year,int month)//?????????
{
    int day;
    if(month==4||month==6||month==9||month==11)
         day=30;
    if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
         day=31;
    if(month==2)
    {
      if(CheckLeap(year)==1)
         day=29;//???29?
      if(CheckLeap(year)==0)
        day=28;//????28?
    }
    return day;
}

int CheckLeap(int year)//????????? ?????1??????0
{
    int jugde=0;//???
    if(year%100!=0)
    {
      if(year%4==0)
        jugde=1;
    }//????100?????4??????
    if(year%100==0)
    {
       if(year%400==0)
         jugde=1;
    }//???100???????400???????
    return jugde;//?????
}


int main()
{
	int year,month,day;
	scanf("%d ",&year);scanf("%d ",&month);scanf("%d",&day);
	if(month==2)
		printf("%d",31+day);
else
	if(month==1)
		printf("%d",day);
	else
	{
		if(month==3)
			day=day+59;
		if(month==4)
			day=day+90;
		if(month==5)
			day=day+120;
		if(month==6)
			day=day+151;
		if(month==7)
			day=day+181;
		if(month==8)
			day=day+212;
		if(month==9)
			day=day+243;
		if(month==10)
			day=day+273;
		if(month==11)
			day=day+304;
		if(month==12)
			day=day+334;
		if(year%4==0 && year %100 !=0 || year %400==0)
			printf("%d",day+1);
		else
			printf("%d",day);
	}
	return 0;
}


int main()
{
	int year,month,day,number;
	scanf("%d%d%d",&year,&month,&day);
	if (month==1)
		number=day;
	else if (month==2)
		number=31+day;
	else
	{
		if ((year%4==0&&year%100!=0)||year%400==0)
		{
			if (month==3)
				number=60+day;
			else if (month==4)
				number=91+day;
			else if (month==5)
				number=day+121;
			else if (month==6)
				number=day+152;
			else if (month==7)
				number=day+182;
			else if (month==8)
				number=day+213;
			else if (month==9)
				number=day+244;
			else if (month==10)
				number=day+274;
			else if (month==11)
				number=day+305;
			else if (month==12)
				number=day+335;
		}
		else
		{
			if (month==3)
				number=59+day;
			else if (month==4)
				number=90+day;
			else if (month==5)
				number=day+120;
			else if (month==6)
				number=day+151;
			else if (month==7)
				number=day+181;
			else if (month==8)
				number=day+212;
			else if (month==9)
				number=day+243;
			else if (month==10)
				number=day+273;
			else if (month==11)
				number=day+304;
			else if (month==12)
				number=day+334;
		}
	}
	printf("%d\n",number);
	return 0;
}


int leapyear(int year){
	if(year%400==0||(year%4==0&&year%100!=0))
		return 1;
	else
		return 0;
}
int whichday(int year,int month,int day){
	int mon[MONTH]={31,28,31,30,31,30,31,31,30,31,30,31};
	int d=0,i;
	if(leapyear(year)==1)
		mon[1]++;
	for(i=0;i<month-1;i++)
		d+=mon[i];
	d+=day;
	return d;
}
int main(){
	int year,month,day;
	int d;
	scanf("%d%d%d",&year,&month,&day);
	d=whichday(year,month,day);
	printf("%d",d);
}


int main(int argc, char* argv[])
{
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	if(a%4==0&&a%100!=0||a%400==0)
	{
			switch(b)
		{
			case 1:
				d=c;
				break;
			case 2:
				d=31+c;
                break;
			case 3:
				d=60+c;
				break;
			case 4:
				d=91+c;
				break;
			case 5:
				d=121+c;
				break;
			case 6:
				d=152+c;
				break;
			case 7:
				d=182+c;
				break;
			case 8:
				d=213+c;
				break;
			case 9:
				d=244+c;
				break;
			case 10:
				d=274+c;
				break;
			case 11:
				d=305+c;
				break;
			case 12:
				d=335+c;
				break;
		}
			printf("%d",d);
	}
		else
		{
			switch(b)
		{
			case 1:
				d=c;
				break;
			case 2:
				d=31+c;
				break;
			case 3:
				d=59+c;
				break;
			case 4:
				d=90+c;
				break;
			case 5:
				d=120+c;
				break;
			case 6:
				d=151+c;
				break;
			case 7:
				d=181+c;
				break;
			case 8:
				d=212+c;
				break;
			case 9:
				d=243+c;
				break;
			case 10:
				d=273+c;
				break;
			case 11:
				d=304+c;
				break;
			case 12:
				d=334+c;
				break;
		}
		printf("%d",d);
		}
	return 0;
}


void main()
{
	int year,month,day;
	int n;
	int a=0;
	scanf("%d %d %d",&year,&month,&day);
	if((year%4==0&&year%100!=0)||year%400==0)
		a=1;
	if(month==1)
		n=day;
	if(month==2)
		n=31+day;
	if(month==3)
		n=59+day;
	if(month==4)
		n=90+day;
	if(month==5)
		n=120+day;
	if(month==6)
		n=151+day;
	if(month==7)
		n=181+day;
	if(month==8)
		n=212+day;
	if(month==9)
		n=243+day;
	if(month==10)
		n=273+day;
	if(month==11)
		n=304+day;
	if(month==12)
		n=334+12;
	if(month>2&&a==1)
		n++;
	printf("%d",n);
}


int main()
{
    int i,year,month,date,num;
    for(i=1;i<=5;i++)
{
         scanf("%d %d %d",&year,&month,&date);
	switch(month)
	{
	case 1:num=0;break;
	case 2:num=31;break;
         case 3:num=59;break;
	case 4:num=90;break;
	case 5:num=120;break;
	case 6:num=151;break;
	case 7:num=181;break;
	case 8:num=212;break;
	case 9:num=243;break;
	case 10:num=273;break;
	case 11:num=304;break;
	case 12:num=334;break;
	}
	if ((year%4==0&&year%100!=0||year%400==0)&&month>2) num+=1;
	num+=date;
	printf("%d\n",num);
}

	return 0;
}


int main()
{
    int y,m,d,j;
    scanf("%d %d %d",&y,&m,&d);
    if(y%4==0)
    {
              if(y%100==0)
              {
                          if(y%400==0)
                          j=1;
                          else
                          j=0;
              }
              else
              j=1;

    }
    else
    j=0;
    if(j==1)
    {      switch(m)
           {case 1:printf("%d",d);break;
           case 2:printf("%d",d+31);break;
           case 3:printf("%d",d+60);break;
           case 4:printf("%d",d+91);break;
           case 5:printf("%d",d+121);break;
           case 6:printf("%d",d+152);break;
           case 7:printf("%d",d+182);break;
           case 8:printf("%d",d+213);break;
           case 9:printf("%d",d+244);break;
           case 10:printf("%d",d+274);break;
           case 11:printf("%d",d+305);break;
           case 12:printf("%d",d+335);break;
           }
}

    if(j==0)
    {switch(m)
           {case 1:printf("%d",d);break;
           case 2:printf("%d",d+31);break;
           case 3:printf("%d",d+59);break;
           case 4:printf("%d",d+90);break;
           case 5:printf("%d",d+120);break;
           case 6:printf("%d",d+151);break;
           case 7:printf("%d",d+181);break;
           case 8:printf("%d",d+212);break;
           case 9:printf("%d",d+243);break;
           case 10:printf("%d",d+273);break;
           case 11:printf("%d",d+304);break;
           case 12:printf("%d",d+334);break;
           }
}

getchar();
getchar();

}


int judge(int);
int main()
{
	int year,month,day,i,j,total=0;
	cin>>year>>month>>day;
	for(i=1;i<=month-1;i++)
	{
		if(i==1 || i==3 || i==5 || i==7 || i==8 || i==10)
			total=total+31;
		else if(i==4 || i==6 || i==9 || i==11)
			total=total+30;
		else if(judge(year)==0 && i==2)
			total=total+28;
		else if(judge(year)==1 && i==2)
            total=total+29;
	}
	total=total+day;
	cout<<total<<endl;
	return 0;
}
int judge(int x)
{
	int y=0;
	if(x%4==0 && x%100!=0 || x%400==0)
		y=1;
	else
		y=0;
	return y;
}


int run(int x)
{
	if((x%4==0 && x%100!=0)||(x%400==0))return 1;
	return 0;
}
int main()
{
	int y,m,d,x;
    scanf("%d %d %d",&y,&m,&d);
		if(run(y))
		{
			switch(m)
	{
	case 1:x=d;break;
	case 2:x=31+d;break;
	case 3:x=60+d;break;
	case 4:x=91+d;break;
	case 5:x=121+d;break;
	case 6:x=152+d;break;
	case 7:x=182+d;break;
	case 8:x=213+d;break;
	case 9:x=244+d;break;
	case 10:x=274+d;break;
	case 11:x=305+d;break;
	case 12:x=335+d;break;
		}
		}
		else{
			switch(m)
	{
	case 1:x=d;break;
	case 2:x=31+d;break;
	case 3:x=59+d;break;
	case 4:x=90+d;break;
	case 5:x=120+d;break;
	case 6:x=151+d;break;
	case 7:x=181+d;break;
	case 8:x=212+d;break;
	case 9:x=243+d;break;
	case 10:x=273+d;break;
	case 11:x=304+d;break;
	case 12:x=334+d;break;
		}
		}
		printf("%d",x);

	return 0;

}


int main()
{
	int y,m,d,i,num,leap;
			leap=0;
			cin>>y>>m>>d;
			if(m==1||m==2)
			{
				if(m==1) num=d;
				else num=31+d;
				cout<<num<<endl;
			}
			else
			{
	        	num=(m-1)*30+d;
				if((y%4==0)&&(y%100!=0)||(y%400==0)) leap=1;
				if(leap==1) num=num-1;
				else num=num-2;
				switch(m)
				{
				case 3:num=num+1;break;
				case 4:
				case 5:num=num+2;break;
				case 6:
				case 7:num=num+3;break;
				case 8:
				case 9:num=num+4;break;
				case 10:num=num+5;break;
				case 11:
				case 12:num=num+6;break;
				default :break;

				}
				cout<<num<<endl;
			}
	return 0;
}


int day_of_month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	int year,month,date;
	cin>>year>>month>>date;
	int total=0;
	if(year%400==0||(year%4==0&&year%100!=0))
	{
		day_of_month[2]=29;

		for(int i=0;i<month;i++)
		{
			total+=day_of_month[i];
		}
		total+=date;
	}
	else
	{
		day_of_month[2]=28;
		for(int i=0;i<month;i++)
		{
			total+=day_of_month[i];
		}
		total+=date;
	}
	cout<<total<<endl;

	return 0;
}


main()
{
	int year;
	int month;
	int day;
	int result=0;
	int i;
	int yue[12]={31,28,31,30,31,30,31,31,30,31,30,31};

	scanf("%d %d %d",&year,&month,&day);

	if((year%100==0&&year%400==0)||year%100!=0&&year%4==0)
		yue[1]=29;

	if(month==1)
	{
		result=result+day;
		printf("%d",result);

	}
	if(month>1)
	{
		for(i=0;i<month-1;i++)
		{
			result=result+yue[i];
		}
		result=result+day;
		printf("%d\n",result);

	}

}


int main()
{
	int N,A,B,a;
	scanf("%d%d%d",&N,&A,&B);
	if(N%100!=0&&N%4==0||N%400==0)
	{
		 for(a=0,A=A-1;A!=0;A--)
		 {
			switch(A)
				{
				case 1:
				case 3:
      			case 5:
    			case 7:
				case 8:
				case 10:
				case 12:a+=31;
					break;
				case 2:a+=29;
					break;
				case 4:
				case 6:
      			case 9:
    			case 11:a+=30;
					break;
				}
		 }
	}
	else
	{
		 for(a=0,A=A-1;A!=0;A--)
		 {
			 switch(A)
				{
				case 1:
				case 3:
      			case 5:
    			case 7:
				case 8:
				case 10:
				case 12:a+=31;
					break;
				case 2:a+=28;
					break;
				case 4:
				case 6:
      			case 9:
    			case 11:a+=30;
					break;
				}
		 }
	 a+=B;
	}
	printf("%d",a);
}


int main()
{
	int year,mon,day,a;
	scanf("%d%d%d",&year,&mon,&day);
	    if(mon==1)
			a=day;
		else if(mon==2)
			a=31+day;
		else if(mon==3)
			a=59+day;
		else if(mon==4)
			a=90+day;
		else if(mon==5)
			a=120+day;
		else if(mon==6)
			a=151+day;
        else if(mon==7)
			a=181+day;
        else if(mon==8)
			a=212+day;
        else if(mon==9)
			a=243+day;
		else if(mon==10)
			a=273+day;
		else if(mon==11)
			a=304+day;
		else
			a=334+day;
		if((year % 4 == 0 && year % 100 !=0 ) || year % 400 == 0)
		{
			if(mon>=3)
				a=a+1;
		}
		printf("%d\n",a);
		return 0;
}