This page is still under construction.

Parts of this page are still being built. What you see may change.

Interesting Numbers

Time limit1sMemory limit512 MB

Summary
Count positive integers between L and R whose decimal digits are nondecreasing, modulo 1e9+7, with L and R up to 10^100.
Level

Medium7 of 10

Topics
Dynamic programming, Combinatorics, Math, Implementation
Solved
No attempts yet

Problem

Sofia considers a number interesting if its digits are in nondecreasing order. For example, 123, 1111, and 888999 are interesting.

Sofia wonders how many interesting positive integers lie in the range from LL to RR inclusive. For large LL and RR this count can be quite large, so Sofia wants the remainder of this count modulo 109+710^9 + 7.

Write a program that, given LL and RR, determines the number of interesting numbers in the range from LL to RR inclusive and prints the remainder of this count modulo 109+710^9 + 7.

Input

The input file contains two lines. The first line contains the number LL, and the second line contains the number RR (1≤L≤R≤101001 \le L \le R \le 10^{100}).

Output

The output file must contain a single integer: the remainder of the number of interesting numbers in the range from LL to RR inclusive modulo 109+710^9 + 7.

Examples1

  1. Example 1

    Input
    1
    100
    
    Expected output
    54