static BigInteger mathOp(S op, BigInteger a, BigInteger b) { if (eq(op, "+")) ret a.add(b); else if (eq(op, "-")) ret a.subtract(b); else if (eq(op, "*")) ret a.multiply(b); else if (eq(op, "/")) ret a.divide(b); else if (eq(op, "^")) ret a.pow(b.intValue()); // weird that it takes an int else throw fail("Unknown math op: " + op); }