public class acm2005 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
String date = in.next();
int y = 0;
int m = 0;
int d = 0;
String str[] = new String[3];
str = date.split("/");
for (int i = 0; i < str.length; i++) {
if (i == 0) {
y = Integer.parseInt(str[i]);
} else if (i == 1) {
m = Integer.parseInt(str[i]);
} else if (i == 2) {
d = Integer.parseInt(str[i]);
}
}
int sum = 0;
for (int month = 1; month < m; month++) {
if (month == 2) {
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0)
sum += 29;
else
sum += 28;
} else {
if (month == 4 || month == 6 || month == 8 || month == 11)
sum += 30;
else
sum += 31;
}