AtCoder Beginner Contest 135
D
Digits Parade
AtCoder
⌀ 1334
原题
← CE →
翻译中…

Problem Statement

翻译中…

Given is a string $S$. Each character in $S$ is either a digit (0, ..., 9) or ?.

翻译中…

Among the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of $5$ when divided by $13$? An integer may begin with $0$.

翻译中…

Since the answer can be enormous, print the count modulo $10^9+7$.

翻译中…

Constraints

翻译中…
  • $S$ is a string consisting of digits (0, ..., 9) and ?.
  • $1 \leq |S| \leq 10^5$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S

翻译中…

Output

翻译中…

Print the number of integers satisfying the condition, modulo $10^9+7$.

翻译中…

样例

Input #1
??2??5
Output #1
768
For example, $482305, 002865,$ and $972665$ satisfy the condition.
Input #2
?44
Output #2
1
Only $044$ satisfies the condition.
Input #3
7?4
Output #3
0
We may not be able to produce an integer satisfying the condition.
Input #4
?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???
Output #4
153716888
题目信息
题号
abc135_d
时间限制
2 s
内存限制
1024 MB

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