private static double oper(double a, double b, Operation op){
        if (a == -1 || b == -1)
            return -1;

        switch (op){
            case ADD:
                return a+b;
            case SUB:
                return a-b;
            case MULT:
                return a*b;
            case DIV:
                if (b == 0) return -1;
                return a/b;
        }
        return -1;
    }