import java.util.ArrayList;
import java.util.List;

public class Euler1004 {
    private static final long MOD = 1_000_000_007L;
    private static final int DIGITS = 10;
    private static final int MAX_CELLS = DIGITS * DIGITS;
    private static final long[] FACTORIAL = new long[MAX_CELLS + 1];

    private static final class Counts {
        long balanced;
        long decreasingExcess;
    }

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

    private static long modInverse(long value) {
        return modPow(value, MOD - 2);
    }

    private static long shapeWordCount(List<Integer> partition) {
        int cells = 0;
        for (int row : partition) {
            cells += row;
        }

        long hookProduct = 1;
        long contentProduct = 1;
        for (int i = 0; i < partition.size(); ++i) {
            int rowLength = partition.get(i);
            for (int j = 0; j < rowLength; ++j) {
                int below = 0;
                for (int r = i + 1; r < partition.size(); ++r) {
                    if (partition.get(r) > j) {
                        ++below;
                    }
                }

                int right = rowLength - j - 1;
                int hook = right + below + 1;
                int content = DIGITS + (j + 1) - (i + 1);
                hookProduct = hookProduct * hook % MOD;
                contentProduct = contentProduct * content % MOD;
            }
        }

        long invHooks = modInverse(hookProduct);
        return FACTORIAL[cells] * contentProduct % MOD * invHooks % MOD * invHooks % MOD;
    }

    private static Counts enumeratePartitions(
            int maxPart,
            int maxRows,
            List<Integer> partition,
            int maxCells) {
        Counts result = new Counts();

        if (!partition.isEmpty()) {
            int cells = 0;
            for (int row : partition) {
                cells += row;
            }

            if (cells <= maxCells) {
                long ways = shapeWordCount(partition);
                int width = partition.get(0);
                int height = partition.size();
                if (width == height) {
                    result.balanced = (result.balanced + ways) % MOD;
                }
                if (height == width + 1) {
                    result.decreasingExcess = (result.decreasingExcess + ways) % MOD;
                }
            }
        }

        if (partition.size() == maxRows) {
            return result;
        }

        int used = 0;
        for (int row : partition) {
            used += row;
        }

        for (int next = maxPart; next >= 1; --next) {
            if (used + next > maxCells) {
                continue;
            }
            partition.add(next);
            Counts child = enumeratePartitions(next, maxRows, partition, maxCells);
            result.balanced = (result.balanced + child.balanced) % MOD;
            result.decreasingExcess = (result.decreasingExcess + child.decreasingExcess) % MOD;
            partition.remove(partition.size() - 1);
        }

        return result;
    }

    private static Counts countAllWords(int maxCells) {
        return enumeratePartitions(DIGITS, DIGITS, new ArrayList<>(), maxCells);
    }

    private static long positiveBalancedCount(int maxDigits) {
        Counts all = countAllWords(maxDigits);
        Counts leadingZeroTails = countAllWords(maxDigits - 1);
        long result = (all.balanced - leadingZeroTails.decreasingExcess - 1) % MOD;
        if (result < 0) {
            result += MOD;
        }
        return result;
    }

    private static void runCheckpoints() {
        if (positiveBalancedCount(4) != 2274) {
            throw new AssertionError("checkpoint failed");
        }
    }

    public static void main(String[] args) {
        FACTORIAL[0] = 1;
        for (int i = 1; i <= MAX_CELLS; ++i) {
            FACTORIAL[i] = FACTORIAL[i - 1] * i % MOD;
        }

        runCheckpoints();
        System.out.println(positiveBalancedCount(MAX_CELLS));
    }
}
