Universal Cup Judging System

Universal Cup

時間限制: 1.0 s 記憶體限制: 1024 MB 總分: 100
统计

Mamy napis składający się z $n$ niezerowych cyfr. Możemy utworzyć wyrażenie, wstawiając co najwyżej jeden ze znaków $+$ (plus) lub $\cdot$ (mnożenie) pomiędzy dowolne dwie kolejne cyfry. Na przykład z napisu 231 możemy utworzyć dziewięć wyrażeń:

$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$.

Obliczamy wartości tych wyrażeń zgodnie ze standardową kolejnością wykonywania działań i wyznaczamy sumę wszystkich wartości. Dla naszego przykładu otrzymujemy

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

Oblicz powyższą sumę modulo $10^9 + 7$.

Wejście

Pierwszy wiersz wejścia zawiera jedną liczbę całkowitą $n$ ($1 \le n \le 10^6$), oznaczającą długość napisu.

Drugi wiersz zawiera napis o długości $n$ składający się z cyfr 1–9.

Wyjście

Wypisz jedną liczbę całkowitą — sumę wszystkich wyrażeń modulo $10^9 + 7$.

Przykład

Wejście

3
231

Wyjście

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.