#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n;
    cin >> n;
    vector<pair<int, int> > v;
    for (int i = 0; i < n; i++)
    {
        ll x, y;
        cin >> x >> y;
        v.push_back(make_pair(x, y));
    }
    vector<pair<int, int> >::iterator it;
    ll result = 0;
    for (it = v.begin(); it != v.end(); it++)
    {
    
       ll n = it->second - it->first + 1;
       ll sum = n * (it->first + it->second) / 2;
       result += sum;
    }
  
    cout << result << endl;
}
// JG GAP GG 



#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<unordered_map>
#include<iomanip>
#include<queue>
#include<bitset>

using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll MOD = 1000000007;
#define rep(n,x) for(ll i=0;i<n;i++) cin>>x[i];
#define forr(a,b) for(ll i=a;i<b;i++);
#define vecsort(myVec,x,y) sort(myVec.begin(),myVec.end(),[](const vector<y> &alpha,const vector<y> &beta){return alpha[x] < beta[x];});
#define vsort(v) sort(v.begin(),v.end());
#define vdownsort(v) sort(v.begin(),v.end(),greater<ll>());
ll modpow(ll a, ll n, ll mod)
{
	ll res = 1;
	while (0 < n)
	{
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}



int main()
{
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	ll n;
	cin >> n;
	ll ans = 0;
	ll a, b;
	for (ll i = 0; i < n; i++)
	{
		cin >> a >> b;
		ans += (a + b) * (b - a + 1) / 2;
	}

	cout << ans << endl;

	return 0;
}