// Arup Guha
// 7/9/03
// This program gets the current date and birth date of a user and
// determines the user's age.
import java.util.*;

public class Age {

    public static void main(String argv[]) {

	Scanner stdin = new Scanner(System.in);

	final int curyear = 2007;

	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 = stdin.nextInt();
	System.out.println("Enter the day of your birthday:");
	day = stdin.nextInt();
	System.out.println("Enter the year of your birthday:");
	year = stdin.nextInt();

	// Reads current date from keyboard.
	System.out.println("Enter today's month:");
	curmonth = stdin.nextInt();
	System.out.println("Enter today's day:");
	curday = stdin.nextInt();

	// 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.");

    }
    
}
