#include <algorithm>
#include <fstream>
#include <queue>
#define NMAX 100100
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORk(i,a,b,k) for(int i = a; i <= b; i+=k)
using namespace std;
pair<int, int> oi[NMAX];
priority_queue<int> q;
ifstream fin("lupu.in");
ofstream fout("lupu.out");
int main()
{
long long int N, L, D, sol = 0;
fin>>N>>D>>L;
FOR(i,1,N)
fin>>oi[i].first>>oi[i].second;
sort(oi+1, oi+N+1);
int i = 1;
FORk(d,0,D,L)
{
while(i <= N && oi[i].first <= d)
q.push(oi[i++].second);
if(!q.empty())
{
sol += q.top();
q.pop();
}
}
fout << sol << '\n';
return 0;
}