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


int main() {
    int N;
    cin >> N;

    vector<P> vec(N);
    rep(i,N) cin >> vec.at(i).first >> vec.at(i).second;

    ll answer=0;

    rep(i,N) {
        answer += (vec.at(i).second-vec.at(i).first+1)*(vec.at(i).first+vec.at(i).second)/2;
    }

    cout << answer << endl;

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

typedef long long ll;
#define pb push_back
#define  fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    fast;
    ll t=1;

    while(t--)
    {
        ll n,sum=0;
        cin>>n;
        for(ll i=0; i<n; i++)
        {
            ll a,b;
            cin>>b>>a;
            b-=1;
            sum+=((a*(a+1))/2);
            sum-=((b*(b+1))/2);
        }
        cout<<sum<<endl;
    }

}
