#include<iostream> #include <climits> #include <cstring> using namespace std; int main ( ) { long long n,k,x,yuzhi=LLONG_MIN, tiji = 0; cin >> n >> k >> x; vector<long long> taozi(n, 0); for(long long i = 0;i < n;++i) { cin >> taozi[i]; } for(long long i = 0;i < k;++i) { for(long long j = 0;j < n;++j) { if(taozi[j] >= x) { tiji += taozi[j]; taozi[j] = yuzhi; } taozi[j] = taozi[j] + 1; } } cout << tiji; return 0; } /* 3 2 5 3 4 6 */