#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>
using namespace std;

struct _arrN{
    int x,s;
};
const int MaxN = 5e5+5;
int n,d,k,f[MaxN];

_arrN arr[MaxN];

bool check(int);

int main(){
    cin>>n>>d>>k;
    for (int i=1; i<=n; i++) {
        cin>>arr[i].x>>arr[i].s;
    }
    // cout<<check(1)<<endl;

    int l=0,r=1e5,ans=-1;
    while (l<=r) {
        int mid = (l+r)/2;
        if (check(mid)) {
            ans=mid;
            r=mid-1;
        }else {
            l=mid+1;
        }
    }

    cout<<ans<<endl;
}


bool check(int g){
    int lSet=max(0,d-g),rSet=d+g;
    for (int i=1; i<sizeof(f)/sizeof(int); i++) {
        f[i]=INT_MIN;
    }
    
    for (int i=1; i<=n; i++) {
        for (int j=i-1; j>=1; j--) {
            if (arr[i].x-arr[j].x<lSet) {
                continue;
            }
            if (arr[i].x-arr[j].x>rSet) {
                break;
            }
            f[i]=max(f[i],f[j]+arr[i].s);
            if (f[i]>=k) {
                return true;
            }
        }
    }
    return false;
}