import java.math.BigInteger;

public class Euler685 {
    static final long MOD = 1000000007L;

    static BigInteger binomSmallK(long n, long k) {
        if (k < 0 || k > n)
            return BigInteger.ZERO;
        if (k > n - k)
            k = n - k;
        BigInteger out = BigInteger.ONE;
        for (long i = 1; i <= k; ++i) {
            out = out.multiply(BigInteger.valueOf(n - k + i)).divide(BigInteger.valueOf(i));
        }
        return out;
    }

    static BigInteger count0To9(long digits, long sum) {
        if (sum > 9 * digits)
            return BigInteger.ZERO;
        if (digits == 0)
            return sum == 0 ? BigInteger.ONE : BigInteger.ZERO;

        BigInteger total = BigInteger.ZERO;
        long maxJ = sum / 10;
        for (long j = 0; j <= maxJ; ++j) {
            long remain = sum - 10 * j;

            BigInteger term = binomSmallK(digits, j).multiply(binomSmallK(digits + remain - 1, remain));
            if ((j & 1) == 0) {
                total = total.add(term);
            } else {
                total = total.subtract(term);
            }
        }
        return total;
    }

    static BigInteger countLenWithSum(long len, long sum) {
        if (len == 0 || sum == 0)
            return BigInteger.ZERO;
        if (sum > 9 * len)
            return BigInteger.ZERO;

        long deficit = 9 * len - sum;
        long maxFirstDeficit = Math.min(8L, deficit);

        BigInteger out = BigInteger.ZERO;
        for (long b0 = 0; b0 <= maxFirstDeficit; ++b0) {
            out = out.add(count0To9(len - 1, deficit - b0));
        }
        return out;
    }

    static long modPow10(long exp) {
        long base = 10;
        long out = 1;
        while (exp > 0) {
            if ((exp & 1) != 0)
                out = (out * base) % MOD;
            base = (base * base) % MOD;
            exp >>= 1;
        }
        return out;
    }

    static long appendDigitMod(long valueMod, int digit) {
        return (valueMod * 10 + digit) % MOD;
    }

    static long appendNinesMod(long valueMod, long count) {
        if (count == 0)
            return valueMod;
        long p10 = modPow10(count);
        return (valueMod * p10 + p10 - 1 + MOD) % MOD;
    }

    static class RankedNumber {
        long len;
        BigInteger rankInside;
    }

    static RankedNumber locateLengthAndRank(long digitSum, long occurrenceRank) {
        BigInteger target = BigInteger.valueOf(occurrenceRank);
        long len = (digitSum + 8) / 9;
        BigInteger prefixCount = BigInteger.ZERO;

        while (true) {
            BigInteger cntHere = countLenWithSum(len, digitSum);
            if (prefixCount.add(cntHere).compareTo(target) >= 0) {
                RankedNumber rn = new RankedNumber();
                rn.len = len;
                rn.rankInside = target.subtract(prefixCount);
                return rn;
            }
            prefixCount = prefixCount.add(cntHere);
            len++;
        }
    }

    static long unrankMod(long len, long digitSum, BigInteger rankInsideLen) {
        long initialDeficit = 9 * len - digitSum;
        long valueMod = 0;
        long remainingDigits = len;
        long remainingDeficit = initialDeficit;

        long maxDeficitHere = Math.min(8L, remainingDeficit);
        for (int deficitDigit = (int) maxDeficitHere; deficitDigit >= 0; --deficitDigit) {
            BigInteger cnt = count0To9(remainingDigits - 1, remainingDeficit - deficitDigit);
            if (rankInsideLen.compareTo(cnt) > 0) {
                rankInsideLen = rankInsideLen.subtract(cnt);
                continue;
            }
            valueMod = appendDigitMod(valueMod, 9 - deficitDigit);
            remainingDeficit -= deficitDigit;
            remainingDigits--;
            break;
        }

        while (remainingDigits > 0) {
            if (remainingDeficit == 0) {
                valueMod = appendNinesMod(valueMod, remainingDigits);
                break;
            }

            BigInteger totalHere = count0To9(remainingDigits, remainingDeficit);
            BigInteger zeroBranch = count0To9(remainingDigits - 1, remainingDeficit);
            BigInteger nonzeroPrefix = totalHere.subtract(zeroBranch);

            if (rankInsideLen.compareTo(nonzeroPrefix) > 0) {
                long low = 1;
                long high = remainingDigits;
                long best = 1;

                while (low <= high) {
                    long mid = low + ((high - low) >> 1);
                    BigInteger suffix = count0To9(remainingDigits - mid, remainingDeficit);
                    BigInteger removed = totalHere.subtract(suffix);

                    if (rankInsideLen.compareTo(removed) > 0) {
                        best = mid;
                        low = mid + 1;
                    } else {
                        if (mid == 0)
                            break;
                        high = mid - 1;
                    }
                }

                BigInteger suffix = count0To9(remainingDigits - best, remainingDeficit);
                BigInteger removed = totalHere.subtract(suffix);
                rankInsideLen = rankInsideLen.subtract(removed);

                valueMod = appendNinesMod(valueMod, best);
                remainingDigits -= best;
                continue;
            }

            long maxDefHere = Math.min(9L, remainingDeficit);
            for (int deficitDigit = (int) maxDefHere; deficitDigit >= 0; --deficitDigit) {
                BigInteger cnt = count0To9(remainingDigits - 1, remainingDeficit - deficitDigit);
                if (rankInsideLen.compareTo(cnt) > 0) {
                    rankInsideLen = rankInsideLen.subtract(cnt);
                    continue;
                }
                valueMod = appendDigitMod(valueMod, 9 - deficitDigit);
                remainingDeficit -= deficitDigit;
                remainingDigits--;
                break;
            }
        }

        return valueMod;
    }

    static long fMod(long digitSum, long occurrenceRank) {
        RankedNumber req = locateLengthAndRank(digitSum, occurrenceRank);
        return unrankMod(req.len, digitSum, req.rankInside);
    }

    public static String solve() {
        long k = 10000;
        long mod = 1000000007;

        long ans = 0;
        for (long n = 1; n <= k; ++n) {
            long s = n * n * n;
            long m = n * s;
            ans = (ans + fMod(s, m)) % mod;
        }

        return Long.toString(ans);
    }

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