import java.io.*; class Keyboard { // Author: M. Dennis Mickunas, June 9, 1997 // Primitive Keyboard input of integers, reals, // strings, and characters. static boolean iseof = false; static char c; static int i; static double d; static String s; static BufferedReader input = new BufferedReader ( new InputStreamReader(System.in)); public static int readInt () { if (iseof) return 0; System.out.flush(); try { s = input.readLine(); } catch (IOException e) { System.exit(-1); } if (s.length()==0) { // ctrl-C iseof=true; return 0; } i = new Integer(s.trim()).intValue(); return i; } public static char readChar () { if (iseof) return (char)0; System.out.flush(); try { 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 { s = input.readLine(); } catch (IOException e) { System.exit(-1); } if (s.length()==0) { iseof=true; return 0.0; } d = new Double(s.trim()).doubleValue(); return d; } public static String readString () { if (iseof) return null; System.out.flush(); try { s=input.readLine(); } catch (IOException e) { System.exit(-1); } if (s==null) { iseof=true; return null; } return s; } public static boolean eof () { return iseof; } }