import java.math.BigInteger;

public class Euler981 {

    static final long MOD = 888888883L;

    static long modPow(long base, long exp) {
        long result = 1 % MOD;
        base %= MOD;
        while (exp > 0) {
            if ((exp & 1) != 0)
                result = (result * base) % MOD;
            base = (base * base) % MOD;
            exp >>= 1;
        }
        return result;
    }

    static long[] fac;
    static long[] invfac;

    static void buildFactorials(int maxN) {
        fac = new long[maxN + 1];
        fac[0] = 1;
        for (int i = 1; i <= maxN; ++i) {
            fac[i] = (fac[i - 1] * i) % MOD;
        }
        invfac = new long[maxN + 1];
        invfac[maxN] = modPow(fac[maxN], MOD - 2);
        for (int i = maxN; i >= 1; --i) {
            invfac[i - 1] = (invfac[i] * i) % MOD;
        }
    }

    static long multinomialMod(int n, int a, int b, int c) {
        long res = fac[n];
        res = (res * invfac[a]) % MOD;
        res = (res * invfac[b]) % MOD;
        res = (res * invfac[c]) % MOD;
        return res;
    }

    static long computeNMod(int X, int Y, int Z) {
        int px = X & 1;
        int py = Y & 1;
        int pz = Z & 1;
        if (px != py || py != pz)
            return 0;

        int S = X + Y + Z;
        long total = multinomialMod(S, X, Y, Z);
        long inv2 = (MOD + 1) / 2;

        if (px == 1) {
            return (total * inv2) % MOD;
        }

        long half = multinomialMod(S / 2, X / 2, Y / 2, Z / 2);
        if ((S / 2) % 2 != 0) {
            long diff = (total + MOD - half) % MOD;
            return (diff * inv2) % MOD;
        }
        long sum = (total + half) % MOD;
        return (sum * inv2) % MOD;
    }

    static BigInteger factorialBig(int n) {
        BigInteger res = BigInteger.ONE;
        for (int i = 2; i <= n; ++i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }

    static BigInteger multinomialBig(int n, int a, int b, int c) {
        BigInteger res = factorialBig(n);
        res = res.divide(factorialBig(a));
        res = res.divide(factorialBig(b));
        res = res.divide(factorialBig(c));
        return res;
    }

    static long computeNExactSmall(int X, int Y, int Z) {
        int px = X & 1;
        int py = Y & 1;
        int pz = Z & 1;
        if (px != py || py != pz)
            return 0;

        int S = X + Y + Z;
        BigInteger total = multinomialBig(S, X, Y, Z);

        if (px == 1) {
            return total.divide(BigInteger.valueOf(2)).longValue();
        }

        BigInteger half = multinomialBig(S / 2, X / 2, Y / 2, Z / 2);
        if ((S / 2) % 2 != 0) {
            return total.subtract(half).divide(BigInteger.valueOf(2)).longValue();
        }
        return total.add(half).divide(BigInteger.valueOf(2)).longValue();
    }

    public static String solve() {
        int maxI = 87;
        int[] cubes = new int[maxI + 1];
        for (int i = 0; i <= maxI; ++i) {
            cubes[i] = i * i * i;
        }
        int maxSum = 3 * cubes[maxI];

        buildFactorials(maxSum);

        long answer = 0;
        for (int i = 0; i <= maxI; ++i) {
            int X = cubes[i];
            for (int j = 0; j <= maxI; ++j) {
                int Y = cubes[j];
                for (int k = 0; k <= maxI; ++k) {
                    int Z = cubes[k];
                    answer += computeNMod(X, Y, Z);
                    if (answer >= MOD)
                        answer -= MOD;
                }
            }
        }

        return Long.toString(answer % MOD);
    }

    public static void main(String[] args) {
        long n222 = computeNExactSmall(2, 2, 2);
        long n888 = computeNExactSmall(8, 8, 8);
        if (n222 != 42L || n888 != 4732773210L) {
            System.err.println("Validation failed: N(2,2,2)=" + n222 + ", N(8,8,8)=" + n888);
            return;
        }
        System.out.println(solve());
    }
}
