Universal Cup Judging System

Universal Cup

実行時間制限: 1.0 s メモリ制限: 1024 MB 満点: 100
統計

لدينا سلسلة نصية تتكون من $n$ أرقام غير صفرية. يمكننا تكوين تعبير رياضي عن طريق إدراج رمز واحد على الأكثر من الرمزين $+$ (جمع) أو $\cdot$ (ضرب) بين أي رقمين متتاليين. على سبيل المثال، من السلسلة 231 يمكننا تكوين تسعة تعابير:

$231$, $23 + 1$, $23 \cdot 1$, $2 + 31$, $2 \cdot 31$, $2 + 3 + 1$, $2 + 3 \cdot 1$, $2 \cdot 3 + 1$, $2 \cdot 3 \cdot 1$.

نقوم بحساب قيم هذه التعابير وفقاً للترتيب القياسي للعمليات الحسابية، ثم نحسب مجموع كل القيم. في مثالنا نحصل على

$$231 + 24 + 23 + 33 + 62 + 6 + 5 + 7 + 6 = 397$$

احسب المجموع أعلاه بباقي القسمة على $10^9 + 7$.

الإدخال

يحتوي السطر الأول من الإدخال على عدد صحيح واحد $n$ ($1 \le n \le 10^6$)، يمثل طول السلسلة.

يحتوي السطر الثاني على سلسلة طولها $n$ تتكون من الأرقام 1–9.

الإخراج

اطبع عدداً صحيحاً واحداً، وهو مجموع جميع التعابير بباقي القسمة على $10^9 + 7$.

مثال

الإدخال

3
231

الإخراج

397

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1053EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.