public class Euler157 {
    static long ipow(int base, int exp) {
        long out = 1;
        while (exp-- > 0)
            out *= base;
        return out;
    }

    static int divisorCount(long x) {
        int count = 1;
        for (long p = 2; p * p <= x; p++) {
            int e = 1;
            while (x % p == 0) {
                x /= p;
                e++;
            }
            count *= e;
        }
        if (x != 1)
            count *= 2;
        return count;
    }

    static long countForN(int n) {
        long total = 0;
        for (int a2 = 0; a2 <= 0; a2++)
            for (int b2 = 0; a2 + b2 <= n; b2++) {
                if (a2 != 0 && b2 != 0)
                    continue;
                for (int a5 = 0; a5 <= (b2 > 0 ? n : 0); a5++)
                    for (int b5 = 0; a5 + b5 <= n; b5++) {
                        if (a5 != 0 && b5 != 0)
                            continue;
                        long left = ipow(2, a2) * ipow(5, a5);
                        long right = ipow(2, b2) * ipow(5, b5);
                        long scale = ipow(2, n - a2 - b2) * ipow(5, n - a5 - b5);
                        total += divisorCount((left + right) * scale);
                    }
            }
        return total;
    }

    public static void main(String[] args) {
        long total = 0;
        for (int n = 1; n <= 9; n++)
            total += countForN(n);
        System.out.println(total);
    }
}
