#include #include #include #include using namespace std; using ll = long long; using P = pair; int main(void){ ll n, k, x; cin >> n >> k >> x; vector a(n); for(auto&x:a) cin >> x; priority_queue, greater> pri; ll now=0, ans=-1e18; for(int i=0; ik) now-=pri.top(), pri.pop(); ans=max(ans, now-x*(i+1)); } cout << ans << endl; return 0; }