import java.io.*;

public class Keyboard
{
	// Author: M. Dennis Mickunas, June 9, 1997
	// Primitive Keyboard input of integers, reals,
	// strings, and characters.
	
	//Amended by:	Bill Steinmetz, 11/4/99

	static boolean iseof = false;
	static char c;
	static int i;
	static double d;
	static String line;

  	public static int readInt ()
  	{
    		if (iseof) return 0;
    		System.out.flush();
    		try
    		{
			InputStreamReader istr = new InputStreamReader(System.in);
			BufferedReader input = new BufferedReader (istr);
     			line = input.readLine(); 
    		}
        	catch (IOException e)
    		{
      			System.exit(-1);
    		}
    		
    		if (line==null)
    		{
      			iseof=true; 
      			return 0;
    		}
    		
    		i = Integer.parseInt (line);
//    		i = new Integer(line.trim()).intValue();	EQUIVALENT
    		return i;
  	}

  	public static char readChar ()
  	{
    		if (iseof) return (char)0;
    		System.out.flush();
    		try
    		{
			BufferedReader input = new BufferedReader (new InputStreamReader(System.in),1);
      			i = input.read(); 
    		}
    		catch (IOException e)
    		{
      			System.exit(-1);
    		}
    		if (i == -1)
    		{
      			iseof=true; 
      			return (char)0;
    		}
    		return (char)i;
  	}

  	public static double readDouble ()
  	{
    		if (iseof) return 0.0;
    		System.out.flush();
    		try
    		{
			BufferedReader input = new BufferedReader (new InputStreamReader(System.in),1);
      			line = input.readLine();
    		}
    		catch (IOException e)
    		{
      			System.exit(-1);
    		}
    		if (line==null)
    		{
      			iseof=true; 
      			return 0.0;
    		}
    		d = new Double(line.trim()).doubleValue();
    		return d;
  	}

  	public static String readString ()
  	{
    		if (iseof) return null;
    		System.out.flush();
    		try
    		{
			BufferedReader input = new BufferedReader (new InputStreamReader(System.in),1);
      			line=input.readLine();
    		}
    		catch (IOException e)
    		{
      			System.exit(-1);
    		}
    		if (line==null)
    		{
      			iseof=true; 
      			return null;
    		}
    		return line;
  	}

  	public static boolean eof ()
  	{
    		return iseof;
  	}

}