There is a sequence of N candies in the store. There are different types of candies, the type of the i-th candy is denoted by Ai.
Andy decided to split the sequence into continuous subarrays so that all the following conditions are satisfied
The value of subarray AL, AL+1, ..., AR is defined as AL+AR. The value of splitting is defined as the sum of values of the subarrays.
Output the minimum possible value of splitting.
As the answer can be pretty large output it modulo 1000000007 (109+7)
Input format
Output format
An integer denoting the minimum value of splitting modulo 1000000007 (109+7)
Constraints
1 ≤ N ≤50000
1 ≤ K ≤ N
1 ≤ Ai ≤ 5
K = 3 A = [1, 1, 3, 1, 3] The optimal splitting will be [1, 1][3, 1, 3] with (A1+A2)+(A3+A5) = 1 + 1 + 3 + 3 = 8 as the value of splitting