#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<queue>
#include<iomanip>
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define int unsigned long long
#define double long double
int f[200050];
int n,d,p;
signed main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>d>>p;
for(int i=1;i<=n;i++) cin>>f[i];
sort(f+1,f+n+1);
//for(int i=1;i<=n;i++) cout<<f[i]<<' ';
//cout<<"\n";
int ans=0,lst=n;
int an=0;
int i;
if(d!=1){
for(i=n;i>=1;i--){
if(i==lst-d){
if(an>p){
ans+=p;
lst=lst-d;
//cout<<lst<<' '<<an<<' '<<ans<<"\n";
an=0;
}
else break;
}
an+=f[i];
}
//cout<<lst<<' '<<i<<' '<<p<<"\n";
an=0;
for(i=lst;i>=1;i--) an+=f[i];
ans+=min(an,p);
}
else{
for(i=n;i>=1;i--) ans+=min(p,f[i]);
}
cout<<ans;
return 0;
}
/*
8 3 3
1 1 4 4 5 6 7 8
*/
WA了14个点,求hack