import java.math.BigInteger;

public class Euler600 {

    static BigInteger choose2(long t) {
        if (t < 2)
            return BigInteger.ZERO;
        BigInteger T = BigInteger.valueOf(t);
        return T.multiply(BigInteger.valueOf(t - 1)).divide(BigInteger.valueOf(2));
    }

    static BigInteger choose3(long t) {
        if (t < 3)
            return BigInteger.ZERO;
        BigInteger T = BigInteger.valueOf(t);
        return T.multiply(BigInteger.valueOf(t - 1)).multiply(BigInteger.valueOf(t - 2)).divide(BigInteger.valueOf(6));
    }

    static BigInteger tet(long r) {
        if (r < 0)
            return BigInteger.ZERO;
        BigInteger R = BigInteger.valueOf(r);
        return R.add(BigInteger.ONE).multiply(R.add(BigInteger.valueOf(2))).multiply(R.add(BigInteger.valueOf(3)))
                .divide(BigInteger.valueOf(6));
    }

    static BigInteger fixIdentity(long n) {
        BigInteger total = BigInteger.ZERO;
        for (long p = -n; p <= n; p++) {
            long T = (n - p) / 2;
            long A0 = Math.max(1, 1 - p);
            long E0 = Math.max(1, p + 1);
            long base = 2 * A0 + E0;
            if (T < base)
                continue;
            long R = T - base;
            total = total.add(tet(R));
        }
        return total;
    }

    static BigInteger fixReflectionEven(long n) {
        BigInteger total = BigInteger.ZERO;
        if (n < 6)
            return BigInteger.ZERO;

        long bmax = (n - 3) / 3;
        for (long b = 1; b <= bmax; b++) {
            long M = n - 3 * b;
            long Amax = (M - 1) / 2;
            if (Amax <= 0)
                continue;

            long Asplit = (n - 4 * b + 1) / 3;
            long m = Math.min(Amax, Math.max(0, Asplit));

            if (m >= 1) {
                long sumA = m * (m + 1) / 2;
                long toAdd = sumA + (b - 1) * m;
                total = total.add(BigInteger.valueOf(toAdd));
            } else {
                m = 0;
            }

            if (Amax > m) {
                long cnt = Amax - m;
                long sumA = Amax * (Amax + 1) / 2 - m * (m + 1) / 2;
                long toAdd = M * cnt - 2 * sumA;
                total = total.add(BigInteger.valueOf(toAdd));
            }
        }
        return total;
    }

    static BigInteger fixReflectionOdd(long n) {
        long T = n / 2;
        if (T < 3)
            return BigInteger.ZERO;
        long amax = (T - 1) / 2;
        long toAdd = amax * (T - (amax + 1));
        return BigInteger.valueOf(toAdd);
    }

    static BigInteger H(long n) {
        BigInteger idVal = fixIdentity(n);
        BigInteger r1 = BigInteger.valueOf(n / 6);
        long T3 = n / 3;
        BigInteger r2 = choose2(T3);
        long T2 = n / 2;
        BigInteger r3 = choose3(T2);
        BigInteger fe = fixReflectionEven(n);
        BigInteger fo = fixReflectionOdd(n);

        BigInteger num = idVal.add(r1.multiply(BigInteger.valueOf(2)))
                .add(r2.multiply(BigInteger.valueOf(2)))
                .add(r3)
                .add(fe.multiply(BigInteger.valueOf(3)))
                .add(fo.multiply(BigInteger.valueOf(3)));
        return num.divide(BigInteger.valueOf(12));
    }

    public static String solve() {
        return H(55106).toString();
    }

    public static void main(String[] args) {
        System.out.println(solve());
    }
}
