#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pp;
const int mxn=10000;
vector<int>visited(mxn,0);
vector<int>adj[mxn];
int prime[mxn];
int M=1e9+7;
void boost() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void sieve(int ending)
{
    for(int i=2;i<ending;i++)
        prime[i]=1;
    for(int i=2;i*i<=ending;i++)
    {
        if(prime[i]==1)
        {
            for(int j=2*i;j<=ending;j=j+i)
            {
                prime[j]=0;
            }
        }
    }
    prime[1]=0;
}

int ncrmodp(int num,int r)
{
    vector<int>C(r+1,0);
    int i,j;
    C[0]=1;
    for(i=1;i<=num;i++)
    {
        for(j=min(i,r);j>0;j--)
        {
            C[j]=((C[j])%M+(C[j-1])%M)%M;
        }
    }
    return C[r];
}

int power(int x,int y)
{
    int res = 1;
    x = x % M;

    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % M;

        y = y>>1; // y = y/2
        x = (x*x) % M;
    }
    return res;
}

void solve()
{

}

signed main()
{
    boost();
    int t;
    cin>>t;
    int ans=0;
    for(int i=0;i<t;i++){
        int a,b;
        cin>>a>>b;
        int sum1=(a-1)*(a)/2;
        int sum2=b*(b+1)/2;
        ans+=sum2-sum1;
    }
    cout<<ans<<endl;
}
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	long long ans = 0;
	while (n--) {
		int l, r; cin >> l >> r;
		ans += (long long) r * (r + 1) / 2 - (long long) (l - 1) * l / 2;
	}
	cout << ans << '\n';
	return 0;
}
