It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight roadand sees many trees line up in the right side. Heights of eachtree which is denoted by a non-negative integer from 0 to 9 can form a tree string. It's very surprising to find thatthe tree string can be represent as an initial string repeating K times. Now he wants to remove some trees to make the rest of the tree stringlooks beautiful. A string is beautiful if and only if the integer it represents is divisible by five. Now he wonders how many ways there are that he could make it. Note that when we transfer the string to a integer, we ignore the leading zeros. For example, the string “00055” will be seen as 55. And also pay attention that two ways are considered different if the removed trees are different. The result can be very large, so printing the answer is enough. And additionally, Xiao Ming can't cut down all trees.
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight road and sees many trees line up in the right side. Heights of each tree which is denoted by a non-negative integer from 0 to 9 can form a tree string. It's very surprising to find that the tree string can be represent as an initial string repeating K times. Now he wants to remove some trees to make the rest of the tree string looks beautiful. A string is beautiful if and only if the integer it represents is divisible by five. Now he wonders how many ways there are that he could make it. Note that when we transfer the string to a integer, we ignore the leading zeros. For example, the string “00055” will be seen as 55. And also pay attention that two ways are considered different if the removed trees are different. The result can be very large, so printing the answer (mod 1000000007) is enough. And additionally, Xiao Ming can't cut down all trees.