Codeforces Round 177 (Div. 1)
E
Polo the Penguin and Lucky Numbers
Codeforces
2800
原题
← D→
翻译中…

Everybody knows that lucky numbers are positive integers that contain only lucky digits 4 and 7 in their decimal representation. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

翻译中…

Polo the Penguin have two positive integers $*l*$ and $*r*$ $(*l* < *r*)$, both of them are lucky numbers. Moreover, their lengths (that is, the number of digits in the decimal representation without the leading zeroes) are equal to each other.

翻译中…

Let's assume that $*n*$ is the number of distinct lucky numbers, each of them cannot be greater than $*r*$ or less than $*l*$, and $*a*_{*i*}$ is the $*i*$-th (in increasing order) number of them. Find $*a*_{1}·*a*_{2} + *a*_{2}·*a*_{3} + ... + *a*_{*n* - 1}·*a*_{*n*}$. As the answer can be rather large, print the remainder after dividing it by $1000000007$ ($10^{9} + 7$).

翻译中…

Input

翻译中…

The first line contains a positive integer $*l*$, and the second line contains a positive integer $*r*$ ($1 ≤ *l* < *r* ≤ 10^{100000}$). The numbers are given without any leading zeroes.

翻译中…

It is guaranteed that the lengths of the given numbers are equal to each other and that both of them are lucky numbers.

翻译中…

Output

翻译中…

In the single line print a single integer — the answer to the problem modulo $1000000007$ ($10^{9} + 7$).

翻译中…

样例

Input #1
4
7
Output #1
28
InputCopy OutputCopy
Input #2
474
777
Output #2
2316330
InputCopy OutputCopy
题目信息
题号
288E
时间限制
2 s
内存限制
256 MB
标签
动态规划
模拟
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。