#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, l, a[100005];
  long long volume = 0;
  scanf("%d%d%d", &n, &k, &l);
  for (int i = 0; i < n * k; i++) scanf("%d", &a[i]);
  sort(a, a + n * k, greater<int>());
  l += a[n * k - 1];
  int left = 0;
  for (int i = 0; i < n * k; i++) {
    left++;
    if (a[i] <= l && left >= k) {
      left -= k;
      volume += a[i];
    }
  }
  if (left)
    cout << 0;
  else
    cout << volume;
  return 0;
}
