#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
long long f[N],x[N],s[N],n,d,k;
bool check(int g){
long long pos;
memset(f,0,sizeof f);
deque<int>q;
long long l=max((long long)1,d-g),r=d+g;
for(int i=1;i<=n;i++){
while(x[pos]+l<=x[i]){
while(!q.empty() && f[q.back()]<f[pos]){
q.pop_back();
}
q.push_back(pos);
pos++;
}
while(!q.empty() && x[q.front()]+r<x[i]){
q.pop_front();
}
if(!q.empty()){
f[i]=f[q.front()]+s[i];
}else{
f[i]=-1e18;
}
if(f[i]>=k){
return 1;
}
}
return 0;
}
int main(){
cin>>n>>d>>k;
for(int i=1;i<=n;++i){
cin>>x[i]>>s[i];
}
int L=1,R=x[n];
while(L<=R){
int mid=(L+R)/2;
if(check(mid)){
R=mid;
}else{
L=mid+1;
}
}
if(L==x[n]){
cout<<-1;
}else{
cout<<L;
}
return 0;
}