#include<bits/stdc++.h>
#define ll long long 
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define w(t) ll t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fo(i,a,n) for(ll i=a;i<n;i++)
#define precision cout<<fixed<<setprecision(10)
const ll mod=1e9+7;
using namespace std;
int main()
{
	IOS
	ll n,s=0,r;
	cin>>n;
  	fo(i,0,n)
    {
      ll a,b;
      cin>>a>>b;
      r=((b*(b+1))/2)-((a*(a-1))/2);
      s=s+r;
    }
  	cout<<s;
}
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

const int INF=1e9;
const int MOD=1e9+7;

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