CF288E.Polo the Penguin and Lucky Numbers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 ll and rr (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 nn is the number of distinct lucky numbers, each of them cannot be greater than rr or less than ll , and aia_{i} is the ii -th (in increasing order) number of them. Find a1a2+a2a3+...+an1ana_{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 10000000071000000007 ( 109+710^{9}+7 ).

输入格式

The first line contains a positive integer ll , and the second line contains a positive integer rr ( 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.

输出格式

In the single line print a single integer — the answer to the problem modulo 10000000071000000007 ( 109+710^{9}+7 ).

输入输出样例

  • 输入#1

    4
    7
    

    输出#1

    28
    
  • 输入#2

    474
    777
    

    输出#2

    2316330
    
首页