AtCoder Grand Contest 013
E
Placing Squares
AtCoder
⌀ 3455
原题
← DF →
翻译中…

Problem Statement

翻译中…

Joisino has a bar of length $N$, which has $M$ marks on it. The distance from the left end of the bar to the $i$-th mark is $X_i$.

翻译中…

She will place several squares on this bar. Here, the following conditions must be met:

翻译中…
  • Only squares with integral length sides can be placed.
  • Each square must be placed so that its bottom side touches the bar.
  • The bar must be completely covered by squares. That is, no square may stick out of the bar, and no part of the bar may be left uncovered.
  • The boundary line of two squares may not be directly above a mark.
翻译中…

image Examples of arrangements that satisfy/violate the conditions

翻译中…

The beauty of an arrangement of squares is defined as the product of the areas of all the squares placed. Joisino is interested in the sum of the beauty over all possible arrangements that satisfy the conditions. Write a program to find it. Since it can be extremely large, print the sum modulo $10^9+7$.

翻译中…

Constraints

翻译中…
  • All input values are integers.
  • $1 \leq N \leq 10^9$
  • $0 \leq M \leq 10^5$
  • $1 \leq X_1 < X_2 < ... < X_{M-1} < X_M \leq N-1$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M
X_1 X_2 ... X_{M-1} X_M

翻译中…

Output

翻译中…

Print the sum of the beauty over all possible arrangements that satisfy the conditions, modulo $10^9+7$.

翻译中…

样例

Input #1
3 1
2
Output #1
13
There are two possible arrangements: - Place a square of side length $1$ to the left, and place another square of side length $2$ to the right - Place a square of side length $3$ The sum of the beauty of these arrangements is $(1 \times 1 \times 2 \times 2) + (3 \times 3) = 13$.
Input #2
5 2
2 3
Output #2
66
Input #3
10 9
1 2 3 4 5 6 7 8 9
Output #3
100
Input #4
1000000000 0
Output #4
693316425
题目信息
题号
agc013_e
时间限制
3 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。