#include using namespace std; using ll = long long; int main(){ ll n, k, x; cin >> n >> k >> x; vector a(n); for(ll i=0; i> a[i]; priority_queue, greater> pq; ll ans = -2147483647; ll csum = 0; for(ll i=0; i k){ csum -= pq.top(); pq.pop(); } ll f = csum - (x * (i+1)); cerr << csum << " " << x*i << " " << f << endl; ans = max(ans, f); } cout << ans << endl; }