#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, 0, n) cin >> a[i] >> b[i];
    ll sum = 0;
    rep(i, 0, n) sum += b[i]*(b[i] + 1)/2 - a[i]*(a[i] - 1)/2;
    cout << sum << endl;
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int n;
	cin>>n;
	ll a,b;ll sum=0LL;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		sum+=(a+b)*(b-a+1)/2;
	}
	cout<<sum;
	return 0;
}
