import java.io.*;
public class ConsoleReader {
private BufferedReader reader;
//costruttore
public ConsoleReader() {
reader = new BufferedReader(new InputStreamReader(System.in));
}
//metodi
public String readLine() {
String inputLine = "";
try {
inputLine = reader.readLine();
} catch (IOException e) {
throw new ConsoleReaderException();
}
return inputLine;
}
public int readInt() {
int r;
String inputString = readLine();
try {
r = Integer.parseInt(inputString);
} catch (NumberFormatException e) {
throw new ConsoleReaderException();
}
return r;
}
public double readDouble() {
double r;
String inputString = readLine();
try {
r = Double.parseDouble(inputString);
} catch (NumberFormatException e) {
throw new ConsoleReaderException();
}
return r;
}
}
//eccezione personalizzata
class ConsoleReaderException extends RuntimeException {
public ConsoleReaderException() {super("Errore Formato di lettura");}
public ConsoleReaderException(String msg) {super(msg);}
}