Codeforces Round 131 (Div. 1)
B
Numbers
Codeforces
1900
原题
← AC →
翻译中…

Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it.

翻译中…

There is integer $*n*$ and array $*a*$, consisting of ten integers, indexed by numbers from 0 to 9. Your task is to count the number of positive integers with the following properties:

翻译中…
  • the number's length does not exceed $*n*$;
  • the number doesn't have leading zeroes;
  • digit $*i*$ $(0 ≤ *i* ≤ 9)$ occurs in the number at least $*a*[*i*]$ times.
翻译中…

Input

翻译中…

The first line contains integer $*n*$ $(1 ≤ *n* ≤ 100)$. The next line contains 10 integers $*a*[0]$, $*a*[1]$, $...$, $*a*[9]$ $(0 ≤ *a*[*i*] ≤ 100)$ — elements of array $*a*$. The numbers are separated by spaces.

翻译中…

Output

翻译中…

On a single line print the remainder of dividing the answer to the problem by $1000000007$ $(10^{9} + 7)$.

翻译中…

Note

翻译中…

In the first sample number 9 meets the requirements.

翻译中…

In the second sample number 10 meets the requirements.

翻译中…

In the third sample numbers 10, 110, 210, 120, 103 meet the requirements. There are other suitable numbers, 36 in total.

翻译中…

样例

Input #1
1
0 0 0 0 0 0 0 0 0 1
Output #1
1
InputCopy OutputCopy
Input #2
2
1 1 0 0 0 0 0 0 0 0
Output #2
1
InputCopy OutputCopy
Input #3
3
1 1 0 0 0 0 0 0 0 0
Output #3
36
InputCopy OutputCopy
题目信息
题号
213B
时间限制
2 s
内存限制
256 MB
标签
组合数学
动态规划

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