include<stdio.h>
include<string.h>
include<stdlib.h>
int main()
{
int compute1(int x,int y,int z);
int x,y,z;
int sum;
scanf("%d %d %d",&x,&y,&z);
sum=compute1(x, y, z);
printf("%d",sum);
return 0;
}
int compute1(int x,int y,int z)
{
int i,sum=0;
for(i=1;i<y;i++)
{
if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
{
sum=sum+31;
}
else if(i==2)
{
sum=sum+28; } else { sum=sum+30; } } if(x%4==0&&x%100!=0) { sum=sum+1; } return sum+z;
}