#include using namespace std; using ull = uint64_t; using ll = int64_t; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define N4(f) \ f(0,1) \ f(0,-1) \ f(1,0) \ f(-1,0) #define N8(f) \ f(y+1,x+1) \ f(y+1,x+0) \ f(y+1,x-1) \ f(y+0,x+1) \ f(y+0,x-1) \ f(y-1,x+1) \ f(y-1,x+0) \ f(y-1,x-1) #define N9(f) \ f(y+1,x+1) \ f(y+1,x+0) \ f(y+1,x-1) \ f(y+0,x+1) \ f(y+0,x+0) \ f(y+0,x-1) \ f(y-1,x+1) \ f(y-1,x+0) \ f(y-1,x-1) signed main() { int n,k,x;cin>>n>>k>>x; vector a(n); rep(i,n)cin>>a[i]; ll ans=-1e12; multiset ms; ll sum=0; rep(i,k)ms.insert(0); rep(i,n) { if (a[i]>=*ms.begin()) { ms.insert(a[i]); sum+=a[i]-*ms.begin(); ms.erase(ms.begin()); ans=max(ans,sum-(i+1)*x); } } cout<