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

int main() {
	long long int t,a,b,s,z,r;
	cin>>t;
	s=0;
	while(t--)
	{
	    cin>>a>>b;
	    z=((b+1)*(b))/2;
	    r=((a)*(a-1))/2;
	    s+=z-r;
	}
	cout<<s<<"\n";
	return 0;
}
/*input
1000 1

*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int T = 1; // cin>>T;
	while(T--)
	{
		int N,W;cin>>N>>W;cout<<(N/W)<<"\n";
	}
	return 0;
}
