// readString(), readInt(), and readDouble()
    // You may copy this code from the course web site.
    public static String readString()
    {
    	String result = "";
    	char c;
        try
        {
            // skip whitespace characters
            while (true)
            {
                c = (char)System.in.read();
                if (!Character.isWhitespace(c))
                        break;
            }
            // now read characters until whitespace
            while (true)
            {
            	result += c;
                c = (char) System.in.read();
                if (Character.isWhitespace(c))
                        break;
            }
        }
        catch (java.io.IOException e)
        {
            System.out.println("Error while reading string.");
            result += "_ERROR_";
        }
        return result;
    }
    public static int readInt()
    {
        return Integer.parseInt(readString());
    }
    public static double readDouble()
    {
        return Double.valueOf(readString()).doubleValue();
    }