@Override
    public Integer solve() {

        final int max = 200000;
        final int[][] c = new int[2][max + 1];
        
        for (int i = 0; i <= max; ++i) {
            c[0][i] = count(2, i);
            c[1][i] = count(5, i);
        }

        int count = 0;
        
        for (int i = (max + 2) / 3; i <= max; ++i) {
            
            final int d2 = c[0][max] - c[0][i] - 12;
            final int d5 = c[1][max] - c[1][i] - 12;
            
            for (int r = max - i, j = (r + 1) / 2, m = min(r, i); j <= m; ++j) {
                
                final int k = r - j;

                if (d5 >= c[1][j] + c[1][k] && d2 >= c[0][j] + c[0][k]) {
                    count += (i == j || j == k) ? 3 : 6;
                }
            }
        }
        
        return count;
    }