use BigInteger.remainder for integer modulo operation (fixes #1)