// better modulo that gives positive numbers always static int mod(int n, int m) { ret (n % m + m) % m; } static long mod(long n, long m) { ret (n % m + m) % m; } static BigInt mod(BigInt n, int m) { ret n.mod(bigint(m)); } static double mod(double n, double m) { ret (n % m + m) % m; }