#include <stdio.h>
#include <iostream>
#include <vector>
// #include <bits/stdc++.h>
#include <queue>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i,k,n) for(ll i=k; i<(ll)(n); i++)


int main(){
    ll n; cin >> n;
    ll a,b;
    ll ans = 0;
    rep(i,0,n) {
        cin >> a >> b;
        ll cnt = b-a+1;
        ans += (a+b)*cnt / 2;
    }


    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=0, c=0,k=0, i, j,l=998244353;
  string s, r, y;
  cin>>n;
  while(n--)
  {
    cin>>a>>m;
    b=m-a+1;
    k+=(b*(2*a+b-1))/2;
   // rep(i, a, m+1) k+=i;
  }
  cout<<k;
}
int main()
{
  
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}