#include<iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <cstring>
#include <set>

#define ll long long
#define ld long double
#define HS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define INF 1e15
#define point complex <double>
#define all(a) a.begin(), a.end()
#define pi acos(-1)
#define file  freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

using namespace std;

int main()
{
    HS;
    int t;
    cin>>t;
    long long sum=0;
    while(t--)
    {
        long long a,b;
        cin>>a>>b;
        sum+=((b*(b+1))/2)-(((a-1)*((a-1)+1))/2);

    }
    cout << sum << endl;
    return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n; cin >> n;
	long sum = 0;
	for ( int i = 0; i < n; i++ ){
		int a, b; cin >> a >> b;
		for ( int j = a; j <= b; j++ ){
			sum = sum + j;
		}
	}
	cout << sum;
}