#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, l, k;
  cin >> n >> k >> l;
  vector<int> v;
  for (int i = 0; i < n * k; i++) {
    int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  auto iter = upper_bound(v.begin(), v.end(), v[0] + l);
  int id = iter - v.begin() - 1;
  if (id < n - 1) {
    cout << 0 << endl;
    return 0;
  }
  long long int sum = 0;
  int left = n;
  int start = 0;
  int end = id;
  while (left != 0) {
    sum += v[start];
    left--;
    int pt = min(start + k, end - left + 1);
    start = pt;
  }
  cout << sum << endl;
  return 0;
}
