import java.util.*;	// you need this if you use Scanner

public class DoomsdayComputer
{
	public static void main(String[] args)
	{
		// Create a scanner so you can read from the keyboard
		Scanner scan = new Scanner(System.in);

		// Prompt the user to input a year between 2000 and 2099
		// and read it into an int variable using the scanner
		// that we created above.
		System.out.println("Please input a year between 2000 and 2099:");
		int year = scan.nextInt();

		// Now compute the day of the week on which the doomsday occur
		// for that year.
		int y = year % 100;
		int a = y / 12;
		int b = y % 12;
		int c = b / 4;
		int d = a + b + c;
		int e = (d + 2) % 7;

		// The value in e represents the day of the week of doomsday
		// (0 = Sunday, 1 = Monday, etc.).  Use e to find the
		// correct substring in the following string to output.
		String days = "SUNMONTUEWEDTHUFRISAT";
		System.out.println("In " + year + ", doomsday occurs on "
			+ days.substring(3*e, 3*e+3));

	}
}
