#include<iostream>
using namespace std;

bool isLeap(int year) {
    return (year % 400 ==0) || (year % 4 ==0 && year % 100 !=0);
}

int main() {
    string date;
    cin >> date;
    
    if(date.length()!=10 || data[4] !='-' || date[7] !='-') {
        cout << "Invalid input";
        return 0;
    }
    int year = stoi(date.substr(0,4));
    int month = stoi(date.substr(5,2));
    int day = stoi(date.substr(8,2));
    
    if(year<=1900 || year >=2100 || month <1 || month > 12 || day >31) {
        cout << "Invalid input";
        return 0;
    }
    int daysInMonth[]={31,28,31,30,31,30,31,31,30,31,30,31};
    
    if (isLeap(year))
        daysInMonth[1]=29;
        
    int totalDays = day;
    for (int i=0; i< month -1; i++)
        totalDays += daysInMonth[i];
        
    cout << totalDays;
    
    return 0;
}