#include #include using namespace std; using ll = long long; constexpr ll e(){return 1ll << 60;} constexpr ll op(ll lhs, ll rhs){ return min(lhs, rhs); } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, b, c; cin >> n >> b >> c; ll tot = 0; vector tmp(n + c, e()); fill(tmp.begin(), tmp.begin() + c, 0); atcoder::segtree seg(tmp); int v; for(int i = c; i < c + n; i++){ cin >> v; tot += v; ll pr = seg.prod(i - c, i); seg.set(i, pr + v); } cout << tot - seg.prod(max(0, n), n + c) << '\n'; }