Background
You have again, again been given the task of calculating the number of landmines in a field. But this time, the field is foggy.
You must calculate the landmine score given a list/string of numbers, the landmine number, and the land distance (all are numbers).
The landmine number tells you where landmines are.
For each digit in the landscape (first number), if the digits left and right add to the landmine number, add the digit in focus to the landmine score.
Note: The very first and last numbers cannot have landmines because they have no numbers to the left and right of them respectively.
Because the field is foggy however, we need to clear the fog and expand the landscape. This is done by repeatedly adding the last two digits of the given landscape and appending it to the end. If the result of the addition has two digits, append the ones digit. This is done until the length of the landscape is equal to the land distance.
Your Task
Sample Input: The landscape, the landmine number, and the land distance. It is given that the land distance is greater than or equal to the length of the number landscape. It is also given that the landscape contains at least two digits.
Output: Return the landmine score.
Explained Examples Note: Expansions are grouped in 5 for demonstration.
Input => Output
178 9 11 => 16
When expanded, the landscape is:
17853 81909 9
Of these:
178 => 1+8 = 9, so add 7
099 => 0+9 = 9, so add 9
7+9 = 16
Input => Output
012 7 21 => 16
Expanding:
01235 83145 94370 77415 6
Of these:
235, 2+5 = 7, add 3
314, 3+4 = 7, add 1
077, 0+7 = 7, add 7
156, 1+6 = 7, add 5
3+1+7+5 = 16
Input => Output
10 10 10 => 0
Expanding:
10112 35831
Of these, there are no landmines.
Input => Output
090909 0 10 => 18
Expanding:
09090 99875
Of these:
090, 0+0=0, add 9
090, 0+0=0, add 9
9+9=18
Test Cases
Input => Output
178 9 11 => 16
012 7 21 => 16
10 10 10 => 0
090909 0 10 => 18
00 0 99 => 0
00 99 99 => 0
91900 18 42 => 1
123121 10 15 => 18
1111111111 2 10 => 8
This is code-golf, so shortest answer wins.
...
Landmine Number Series