#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,q;
    vector<long> d;
    vector<long> p;
    long num=0;
    cin>>n>>q;
    for(int i=1; i<=n; i++) {
        long di, pi;
        cin>>di>>pi;
        d.push_back(di);
        p.push_back(pi);
    }
    long k; cin>>k;
    for(int i=0; i<n; i++) {
        if(d[i]>k) {
            break;
        } else if(d[i]+p[i]<=k) {
            num+=p[i];
        } else {
            num=num+k-d[i]+1;
        }
    }
    cout<<num<<endl;
    return 0;
}