private static InputStream is = System.in;
public static int nextInt() {
try {
int i;
while ((i = is.read()) < 45 || i > 57) {
}
int mark = 1, temp = 0;
if (i == 45) {
mark = -1;
i = is.read();
}
while (i > 47 && i < 58) {
temp = temp * 10 + i - 48;
i = is.read();
}
return temp * mark;
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}