Staircase#363

Staircase

1 second
122.174 megabytes
Medium (≈1350)

There are N+2 steps on a staircase, with the first and last steps having the number 0, and each of the others labeled with one integer. A person standing on the first step can move up any number of steps as long as the number does not exceed K in one move.

Find the maximum sum this person can collect by reaching the last step, summing the numbers on the steps they touch.

Input

The first line gives the integer n (0 ≤ n ≤ 1000). The second line contains n integers written on the steps, separated by spaces, each having an absolute value not exceeding 1000 (the first and last steps have a zero). The third line provides the maximum step length k (1 ≤ k ≤ n) the person can take.

Output

Output a single number – the maximum sum the person can collect by reaching the last step.

Examples

Example 1

Loading
Loading