//Anamary Leal (modified by Chris Poon)
// BHCSI 2005.
//7/14/05
// Solution to BHCSI 7/15/05 Programming Contest Problem: Time Management

import java.io.*;
import java.lang.Math;

public class time
{
	public static void main(String args[]) throws IOException
	{
		final int TOTAL_HRS = 8;	//hours to start with in day.
		final int WORD_LIMIT = 4000;//word limit for an IM session.
		final int WORDSPPPH = 400;  //words per person per hour.
		int choice = 0, hoursleft = TOTAL_HRS, numppl;
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		
		//this give the menu
		while(choice != 2 && choice != 3 && hoursleft > 0)
		{
			System.out.println("Hello, you have "+hoursleft+" hours left. Please make a selection:");
			System.out.println("1. Go online");			
			System.out.println("2. Do homework");	
			System.out.println("3. I'm done for the day. I'm getting sleep.");	
			choice = Integer.parseInt(input.readLine());
			
			//if go online
			if(choice == 1)
			{
				System.out.println("How many people are you talking to:");	
				numppl = Integer.parseInt(input.readLine());
				
		
				hoursleft -= Math.ceil(WORD_LIMIT/(WORDSPPPH*numppl));
							
			}
		}
		

		//if she decides to do her homework, output
		if(choice == 2)
		{
			if(hoursleft > 1)
			{
				System.out.println("You managed to finish your homework with " +(hoursleft-2)+" hours to spare!");
			}
			else
			{
				System.out.println("You did not finish your homework.");
			}
		}
		//she decided to go to sleep
		else if (choice==3)
		{
			if(hoursleft > 1)
			{
				System.out.println("You still have time to do your homework!");
			}
			else
			{
				System.out.println("It's too late to do your homework.");
			}
		}
		//she's run out of time
		else{
			System.out.println("Sorry Susie, you ran out of time and you didn't do your homework!");
		}
	}
}