Code lock
"Ali Baba and the Forty Thieves"
We all know the tale of how Ali Baba overheard the magical phrase that opened the doors in the rock, granting him entry to the thieves' hideout. However, not many are aware that the entrance to the treasure chamber, where the thieves kept their stolen wealth, was secured by a mechanical combination lock. This lock required a code to be entered using N wheels. Each wheel could be rotated to display a digit from 0 to 9, but some wheels were stuck on a specific digit and could not be moved. Ali Baba only knew that for the correct code, the sum of any k consecutive digits must be the same and equal to S.
Your task is to determine how many different combinations Ali Baba needed to try in order to unlock the treasury.
Input
The first line contains three integers: N, k, and S ((1 N 100), (1 k 6), (0 S 100)). The second line contains N characters without spaces, each representing the state of a wheel. The symbol «?» indicates that the wheel is functional and can be set to any digit, while any numeric symbol indicates that the wheel is stuck on that specific digit.
Output
Output a single integer - the number of digit combinations that can be entered on the lock, such that the sum of any k consecutive digits equals S.