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

const int INF = 1001001001;

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

int main()
{
    int n;
    cin>>n;
    long long int a[n],b[n],ans=0;
    for(int i=0;i<n;i++) 
    {
        cin>>a[i]>>b[i];
        ans += ((b[i]*(b[i]+1)/2) - (a[i]*(a[i]+1))/2 + a[i]);
    }
    cout<<ans;
    return 0;
}
