#include<iostream>
#include<string>
using namespace std;
bool isLeap(int year) {
    if((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0))
    return true;
    return false;
    
}
int main(){
    string date;
    cin >> date;
    if(date.length() != 10 || data[4] != '-' || data[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 < 1 || 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;
}

if (day > daysInMonth[month - 1]) {
    cout << "Invalid input";
    return 0;
} 
int totalDays = 0;

for (int i =0; i < month - 1; i++) {
    totalDays += daysInMonth[i];
}

totalDays += day;

cout << totalDays;
return 0;
}