CF756F.Long number

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Consider the following grammar:

  • ::= | '+'
  • ::= | '-' | '(' ')'
  • ::= <pos_digit> |
  • ::= '0' | <pos_digit>
  • <pos_digit> ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'

This grammar describes a number in decimal system using the following rules:

  • describes itself,
  • - (l-r, l<=rl<=r ) describes integer which is concatenation of all integers from ll to rr , written without leading zeros. For example, 8-11 describes 891011,
  • () describes integer which is concatenation of copies of integer described by ,
  • + describes integer which is concatenation of integers described by and .

For example, 2(2-4+1)+2(2(17)) describes the integer 2341234117171717.

You are given an expression in the given grammar. Print the integer described by it modulo 109+710^{9}+7 .

输入格式

The only line contains a non-empty string at most 10510^{5} characters long which is valid according to the given grammar. In particular, it means that in terms l-r l<=rl<=r holds.

输出格式

Print single integer — the number described by the expression modulo 109+710^{9}+7 .

输入输出样例

  • 输入#1

    8-11
    

    输出#1

    891011
    
  • 输入#2

    2(2-4+1)+2(2(17))
    

    输出#2

    100783079
    
  • 输入#3

    1234-5678
    

    输出#3

    745428774
    
  • 输入#4

    1+2+3+4-5+6+7-9
    

    输出#4

    123456789
    
首页