public double[] nextDoubles(int n) throws IOException {
            double[] res = new double[n];
            for (int i = 0; i < n; ++i) {
                res[i] = nextDouble();
            }
            return res;
        }