#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define For(n) for(int i=0;i<n;i++)
#define in(x) int x; cin>>x;
#define rrep(i,a,n) for(int i=n;i>=a;i--)
#define out(x) cout<<x<<'\n';
#define vi vector<int>
#define pi pair<int,int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define FAST ios::sync_with_stdio(0); cin.tie(0);  cout.tie(0);
using namespace std;
using ll = long long;
int main() {
	int n;
	cin>>n;
    ll s=0;
    while(n--)
    {
        ll a,b;
        cin>>a>>b;
        s+=(b*(b+1))/2;
        s-=(a*(a-1))/2;
    }
	out(s)
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define ll long long
using namespace std;
int main() {
	ll n;
	cin >> n;
	ll sum = 0;
	rep(i, 0, n) {
		ll a, b;
		cin >> a >> b;
		sum += (b + a) * (b - a + 1) / 2;
	}
	cout << sum << "\n";
}