import java.io.*;

class Age {

    public static void main(String argv[]) throws IOException {

	BufferedReader stdin = new BufferedReader
	    (new InputStreamReader(System.in));

	final int curyear = 1999;
	int age = 0;
	int month, day, year; // Stores birthday of user
	int curmonth, curday; // Stores current date
	
	// Reads users birthday from keyboard.
	System.out.println("Enter the month of your birthday:");
	month = Integer.parseInt(stdin.readLine());
	System.out.println("Enter the day of your birthday:");
	day = Integer.parseInt(stdin.readLine());
	System.out.println("Enter the year of your birthday:");
	year = Integer.parseInt(stdin.readLine());

	// Reads current date from keyboard.
	System.out.println("Enter today's month:");
	curmonth= Integer.parseInt(stdin.readLine());
	System.out.println("Enter today's day:");
	curday = Integer.parseInt(stdin.readLine());

	// Calculates age based on whether the user's birthday has already
	// happened this calendar year
	if (curmonth > month)
	    age = curyear - year;
	else if (curmonth == month) {
	    if (curday >= day)
		age = curyear - year;
	    else
		age = curyear - year - 1;
	}
	else
	    age = curyear - year - 1;

	System.out.println("You are " + age + " years old.");

    }
    
}
