There are `n` piles of stones arranged in a row. The `i`th pile has `stones[i]` stones.
A move consists of merging exactly `k` **consecutive** piles into one pile, and the cost of this move is equal to the total number of stones in these `k` piles.
Return the minimum cost to merge all piles into one pile. If it is impossible, return `-1`.
Example 1
Input:stones = [3,2,4,1], k = 2
Output:20
Explanation:Merge [3,2] cost 5, then [4,1] cost 5, then [5,5] cost 10. Total = 20.
Example 2
Input:stones = [3,2,4,1], k = 3
Output:-1
Explanation:We cannot merge all piles with k=3 since (4-1) is not divisible by (3-1).