#include <bits/stdc++.h>
using namespace std;
int main()
{
	
	long long int i,n,q,p[100000],d[100000],br=0,br2=0,r=0,br3=0,q1;
	
	cin>>n;
	cin>>q1;
	for(i=0;i<n;i++)
	{
		cin>>d[i];
		cin>>p[i];
	}

	cin>>q;
	
	while(br<=q)
	{

		if((d[br2]+p[br2])>q)
		{
			br3=d[br2];
			while(br3<=q)
			{
				r++;
				br3++;
			}
			br=q+1;
		}
		else
		{
			r=r+p[br2];
		}
		br2++;
	}
	
    cout<<r;

}