You are given an array a_1, a_2, ... , a_n and two integers m and k.

You can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r. 

The cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equal to ∑_{i=l}^{r} a_i - k ⌈ (r - l + 1)/(m) ⌉, where ⌈ x ⌉ is the least integer greater than or equal to x. 

The cost of empty subarray is equal to zero.

For example, if m = 3, k = 10 and a = [2, -4, 15, -3, 4, 8, 3], then the cost of some subarrays are:

  * a_3 ... a_3: 15 - k ⌈ 1/3 ⌉ = 15 - 10 = 5; 
  * a_3 ... a_4: (15 - 3) - k ⌈ 2/3 ⌉ = 12 - 10 = 2; 
  * a_3 ... a_5: (15 - 3 + 4) - k ⌈ 3/3 ⌉ = 16 - 10 = 6; 
  * a_3 ... a_6: (15 - 3 + 4 + 8) - k ⌈ 4/3 ⌉ = 24 - 20 = 4; 
  * a_3 ... a_7: (15 - 3 + 4 + 8 + 3) - k ⌈ 5/3 ⌉ = 27 - 20 = 7. 



Your task is to find the maximum cost of some subarray (possibly empty) of array a.

Input

The first line contains three integers n, m, and k (1 ≤ n ≤ 3 ⋅ 10^5, 1 ≤ m ≤ 10, 1 ≤ k ≤ 10^9).

The second line contains n integers a_1, a_2, ..., a_n (-10^9 ≤ a_i ≤ 10^9).

Output

Print the maximum cost of some subarray of array a.

Examples

Input


7 3 10
2 -4 15 -3 4 8 3


Output


7


Input


5 2 1000
-13 -4 -9 -20 -11


Output


0
import javax.swing.text.Segment;
import java.io.*;
import java.util.*;

public class CP {
    public static void main(String[] args) throws Exception {
        /*new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    new Solver().solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }, "Solver", 1l << 30).start();*/

        new Solver().solve();
    }
}

class Solver {
    IO io = new IO(System.in, System.out);

    int N, M;
    long K;
    long[] A;

    void solve() throws Exception {
        int i, j, k;

        N = io.nextInt(); M = io.nextInt();
        K = io.nextLong();
        A = new long[N];
        for (i = 0; i < N; ++i) A[i] = io.nextLong();

        long[] prefix = new long[N];
        for (i = 0; i < N; ++i) prefix[i] = A[i] + (i > 0 ? prefix[i - 1] : 0);

        long[] fact = new long[N];
        for (i = 0; i < N; ++i) fact[i] = K * ((i + M) / M);

        //System.out.println(Arrays.toString(fact));
        //System.out.println(Arrays.toString(prefix));

        ArrayList<Long>[] lists = new ArrayList[M];
        for (i = 0; i < M; ++i) lists[i] = new ArrayList<>();

        for (i = 0; i < N; ++i) lists[i % M].add(prefix[i] - fact[i]);

        SegmentTree[] segmentTrees = new SegmentTree[M];
        for (i = 0; i < M; ++i) {
            long[] temp = new long[lists[i].size()];
            for (j = 0; j < temp.length; ++j) temp[j] = lists[i].get(j);
            segmentTrees[i] = new SegmentTree(temp);
        }

        //System.out.println();

        long ans = 0;
        for (i = 0; i < N; ++i) {
            k = 0;
            for (SegmentTree segT : segmentTrees) {
                //System.out.print(segT);

                if (k >= i % M)
                    ans = Math.max(ans, segT.query(i / M));
                else
                    ans = Math.max(ans, segT.query(i / M + 1));
                segT.update(-A[i]);

                ++k;
            }
            //System.out.println();

            segmentTrees[i % M].update(K);
        }

        io.println(ans);

        io.flush();
    }
}

class SegmentTree {
    int N;
    long[] tree, pending;

    SegmentTree(long[] ar) {
        N = 1; while (N < ar.length) N <<= 1;
        tree = new long[N * 2 - 1];
        pending = new long[N * 2 - 1];
        Arrays.fill(tree, Long.MIN_VALUE >> 2);

        for (int i = 0; i < ar.length; ++i) tree[i + N - 1] = ar[i];
        for (int i = N - 2; i >= 0; --i)
            tree[i] = Math.max(tree[i * 2 + 1], tree[i * 2 + 2]);
    }

    void push(int i) {
        tree[i] += pending[i];
        if (i < N - 1) {
            pending[i * 2 + 1] += pending[i];
            pending[i * 2 + 2] += pending[i];
        }
        pending[i] = 0;
    }

    long query(int startInd) {
        return query(0, 0, N - 1, startInd, N);
    }

    long query(int i, int l, int r, int ql, int qr) {
        push(i);
        int mid = l + r >> 1, i2 = i << 1;
        if (l > qr || r < ql) return Long.MIN_VALUE;
        else if (l >= ql && r <= qr) return tree[i];
        else return Math.max(query(i2 + 1, l, mid, ql, qr),
                query(i2 + 2, mid + 1, r, ql, qr));
    }

    void update(long val) {
        pending[0] += val;
    }
}



class IO {
    static byte[] buf = new byte[2048];
    static int index, total;
    static InputStream in;
    static BufferedWriter bw;


    IO(InputStream is, OutputStream os) {
        try {
            in = is;
            bw = new BufferedWriter(new OutputStreamWriter(os));
        } catch (Exception e) {
        }
    }

    IO(String inputFile, String outputFile) {
        try {
            in = new FileInputStream(inputFile);
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outputFile)));
        } catch (Exception e) {
        }
    }

    int scan() throws Exception {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0)
                return -1;
        }
        return buf[index++];
    }

    String next() throws Exception {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan())
            sb.append((char) c);
        return sb.toString();
    }

    int nextInt() throws Exception {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    long nextLong() throws Exception {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    void print(Object a) throws Exception {
        bw.write(a.toString());
    }

    void printsp(Object a) throws Exception {
        print(a);
        bw.write(" ");
    }

    void println() throws Exception {
        bw.write("\n");
    }

    void println(Object a) throws Exception {
        print(a);
        println();
    }

    void flush() throws Exception {
        bw.flush();
        bw.close();
    }
}