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
#include <bits/stdc++.h>
using iii = int;
using yeee = iii;
const iii DEBUG = -1;
using namespace std;
using namespace chrono;
template <typename T1>
void DOUTf(ostringstream &os, int names_i, vector<string> &names, T1 &&val) {
  os << names[names_i] << " = " << val;
}
template <typename T1, typename... Ts>
void DOUTf(ostringstream &os, int names_i, vector<string> &names, T1 &&val,
           Ts &&...vals) {
  os << names[names_i] << " = " << val << " | ";
  DOUTf(os, names_i + 1, names, vals...);
}
template <typename... Ts>
string DOUTg(string names, Ts &&...vals) {
  string special = "()[]{}<>'\"\\";
  vector<string> vnames;
  vnames.push_back("");
  vector<char> stak;
  for (char c : names) {
    bool inside_string =
        !stak.empty() && (stak.back() == '\'' || stak.back() == '\"');
    if (c == '\n') c = ' ';
    if (c == ' ' && (vnames.back().empty() ||
                     (!inside_string && vnames.back().back() == ' ')))
      continue;
    if (stak.empty() && c == ',') {
      if (!vnames.back().empty() && vnames.back().back() == ' ')
        vnames.back().pop_back();
      vnames.push_back("");
      continue;
    }
    vnames.back().push_back(c);
    if (!stak.empty() && stak.back() == '\\') {
      stak.pop_back();
      continue;
    }
    size_t p = special.find(c);
    bool closing = p < 8 && p % 2;
    if (p == string::npos) continue;
    if (p == special.size() - 1) {
      stak.push_back(c);
      continue;
    }
    if (stak.empty()) {
      if (!closing) stak.push_back(c);
      continue;
    }
    if (inside_string) {
      if (c == stak.back()) stak.pop_back();
      continue;
    }
    if (closing) {
      if (stak.back() == special[p - 1]) stak.pop_back();
      continue;
    }
    stak.push_back(c);
  }
  ostringstream os;
  DOUTf(os, 0, vnames, vals...);
  return os.str();
}
template <template <typename...> class Container, typename T, size_t DIMENSION>
struct MultiDimensional {
  using internal = MultiDimensional<Container, T, DIMENSION - 1>;
  using type = Container<typename internal::type>;
  template <typename... Args>
  static type Generate(T def, const size_t size, Args... sizes) {
    return type(size, internal::Generate(def, sizes...));
  }
};
template <template <typename...> class Container, typename T>
struct MultiDimensional<Container, T, 1> {
  using internal = T;
  using type = Container<T>;
  static type Generate(T def, const size_t size) { return type(size, def); }
};
template <typename T, typename... Args>
auto make_vector(T def, Args... sizes) ->
    typename MultiDimensional<std::vector, T, sizeof...(sizes)>::type {
  return MultiDimensional<std::vector, T, sizeof...(sizes)>::Generate(def,
                                                                      sizes...);
}
template <typename T>
T get() {
  T x;
  cin >> x;
  return x;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &cont) {
  out << "(" << cont.first << ", " << cont.second << ")";
  return out;
}
template <typename T, typename Alloc>
ostream &operator<<(ostream &out, const vector<T, Alloc> &cont) {
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : " ") << *it;
  return out;
}
template <typename T, typename Alloc>
ostream &operator<<(ostream &out, const deque<T, Alloc> &cont) {
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : " ") << *it;
  return out;
}
template <typename T, typename Compare, typename Alloc>
ostream &operator<<(ostream &out, const set<T, Compare, Alloc> &cont) {
  out << "{";
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : ", ") << *it;
  out << "}";
  return out;
}
template <typename T, typename Compare, typename Alloc>
ostream &operator<<(ostream &out, const multiset<T, Compare, Alloc> &cont) {
  out << "{";
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : ", ") << *it;
  out << "}";
  return out;
}
template <typename Key, typename T, typename Compare, typename Alloc>
ostream &operator<<(ostream &out, const map<Key, T, Compare, Alloc> &cont) {
  out << "{";
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : ", ") << it->first << ":" << it->second;
  out << "}";
  return out;
}
template <typename Key, typename T, typename Compare, typename Alloc>
ostream &operator<<(ostream &out,
                    const multimap<Key, T, Compare, Alloc> &cont) {
  out << "{";
  for (auto it = cont.begin(); it != cont.end(); ++it)
    out << (it == cont.begin() ? "" : ", ") << it->first << ":" << it->second;
  out << "}";
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<vector<T>> cont) {
  for (auto it = cont.begin(); it != cont.end(); ++it) out << *it << "\n";
  return out;
}
using ll = long long;
using lll = long long;
using ull = unsigned long long;
using ld = long double;
using pll = pair<ll, ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpll = vector<pll>;
using point = complex<ld>;
ld get_time() {
  return ld(duration_cast<nanoseconds>(
                high_resolution_clock::now().time_since_epoch())
                .count()) /
         1e9;
}
ll sign(ld x) { return (x > 0) - (x < 0); }
ll fmod(ll x, ll mod) {
  if (!mod) return x;
  if (abs(x) >= mod) x %= mod;
  if (x < 0) x += mod;
  return x;
}
ll pow(ll x, ll exp, ll mod) {
  ll res = 1, y = x;
  while (exp) {
    if (!mod) {
      if (exp & 1) res = res * y;
      y = y * y;
    } else {
      if (exp & 1) res = fmod(res * y, mod);
      y = fmod(y * y, mod);
    }
    exp >>= 1;
  }
  return res;
}
ld START_TIME = get_time();
mt19937_64 rand_mt64(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rand_mt(chrono::steady_clock::now().time_since_epoch().count());
const long long INFll = ll(1.1e18) - 1;
const int INFi = ll(1.1e9) - 1;
ll INF = sizeof(ll) == sizeof(int) ? ll(INFi) : ll(INFll);
char newl = '\n';
void main_init(string input_file = "", string output_file = "",
               bool fast_cio = true) {
  srand(unsigned(time(0)));
  if (fast_cio) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  if (DEBUG >= 0 && input_file != "") freopen(input_file.c_str(), "r", stdin);
  if (DEBUG >= 0 && output_file != "")
    freopen(output_file.c_str(), "w", stdout);
}
yeee main() {
  main_init();
  ll N, M, K;
  cin >> N >> M >> K;
  vvll V(N, vll(M + 1, -INF));
  for (ll i = ll(0); i < ll(N); ++i) {
    cin >> V[i][0];
    V[i][1] = V[i][0] - K;
  }
  for (ll j = ll(2); j < ll(M + 1); ++j) {
    for (ll i = ll(0); i < ll(N - j + 1); ++i) {
      V[i][j] = V[i + 1][j - 1] + V[i][0];
    }
  }
  if (DEBUG >= 1) cout << V << endl;
  ll res = 0;
  for (ll i = ll(0); i < ll(N); ++i) {
    for (ll j = ll(1); j < ll(M + 1); ++j) res = max(res, V[i][j]);
  }
  for (ll si = ll(0); si < ll(M); ++si) {
    ll s = 0;
    for (ll ci = si; ci < N; ci += M) {
      for (ll j = ll(0); j < ll(M + 1); ++j)
        res = max(res, s + bool(j) * V[ci][j]);
      s += V[ci][M];
      if (s < 0) s = 0;
      if (DEBUG >= 2) cout << DOUTg("si, ci, s, res", si, ci, s, res) << endl;
    }
  }
  cout << res << endl;
}
