8VC Venture Cup 2017 - Final Round
翻译中…
Consider the following grammar:
翻译中…
<expression> ::= <term> | <expression> '+' <term><term> ::= <number> | <number> '-' <number> | <number> '(' <expression> ')'<number> ::= <pos_digit> | <number> <digit><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:
翻译中…
<number>describes itself,<number>-<number>(l-r,$*l* ≤ *r*$) describes integer which is concatenation of all integers from$*l*$to$*r*$, written without leading zeros. For example,8-11describes891011,<number>(<expression>)describes integer which is concatenation ofcopies of integer described by <expression>,<expression>+<term>describes integer which is concatenation of integers described by<expression>and<term>.
翻译中…
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 $10^{9} + 7$.
翻译中…
Input
翻译中…
The only line contains a non-empty string at most $10^{5}$ characters long which is valid according to the given grammar. In particular, it means that in terms l-r $*l* ≤ *r*$ holds.
翻译中…
Output
翻译中…
Print single integer — the number described by the expression modulo $10^{9} + 7$.
翻译中…
样例
Input #1
8-11
Output #1
891011
InputCopy
OutputCopy
Input #2
2(2-4+1)+2(2(17))
Output #2
100783079
InputCopy
OutputCopy
Input #3
1234-5678
Output #3
745428774
InputCopy
OutputCopy
Input #4
1+2+3+4-5+6+7-9
Output #4
123456789
InputCopy
OutputCopy
题目信息
标签
表达式解析
数学
数论
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。