[NOIP Simulation Test]: mine (DP)

Title Description

There is a $ 1 $ dimensional minesweeper, each grid with $ * $ expressed mine, with $ 0/1/2 $ indicates no mine and adjacent grid have $ 0/1/2 $ a mine.
Given a only $? $, $ * $, $ 0 $, $ 1 $, $ 2 $ string $ s $, ask how many ways all of the $? $ Instead $ * / 0/1/2 $ make it legal.


 

Input Format

Line of a character $ s $.


Output Format

A line answer integer of $ ^ {10} $ modulo 9 + 7.


 

Sample

Sample input:

?1?

Sample output:

2


 

Data range and tips

For $ 30 \% $ data, $ | S | \ leqslant 20 $.
For $ 60 \% $ data, $ | S | \ leqslant 1,000 $.
For $ 100 \% $ data, $ | S | \ leqslant { 10} ^ 6 $.


 

answer

Guess you like

Origin www.cnblogs.com/wzc521/p/11374114.html