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


int main()
{
	long long n;
	cin >> n;

	long long sum = 0;

	for (long long i = 0 ; i < n ; i++) 
	{
		long long a = 0;
		long long b = 0;

		cin >> a >> b;

		sum += ((a + b) * (b - a + 1)) / 2;

	}

	cout << sum << endl;
}



#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
//=======================
const ll MOD = 1000000007;
const ll N = 2e6+13, M = N;
//=======================
vi g[N];
ll arr[N];
vi a;
ll n, m, k;
//=======================

void solve() {
  ll i, j;
  cin >> n;
  vpii arr(n);
  ll sum = 0;
  fo(i, n) {
    ll x, y;
    cin >> x >> y;
    sum = sum + (((y* (y + 1))/2) - ((x*(x+1)) / 2) + x);
  }
  cout << sum << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ll t = 1;
    while(t--) {
      solve();
    }

    return 0;
}