class MyInputStream extends InputStream { public BufferedInputStream bis = new BufferedInputStream(System.in); public int read() throws IOException { int i; while ((i = bis.read()) < 48) if (i == -1) return -1; int temp = 0; while (i > 47) { temp = temp * 10 + i - 48; i = bis.read(); } return temp; } }