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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (x).size()

ll mod = 998244353;

ll gcd(ll a, ll b){
  if (a%b == 0)return(b);
  else return(gcd(b, a%b));
}

ll inv(ll x){
  ll res = 1;
  ll k = mod - 2;
  ll y = x;
  while(k){
    if(k&1)res = (res*y)%mod;
    y = (y*y) % mod;
    k /= 2;
  }
  return res;
}

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

  int n;
  cin >> n;
  ll ret = 0;
  rep(i,n){
    ll a,b;
    cin >> a >> b;
    ret += (a+b)*(b-a+1)/2;
  }
  cout << ret << endl;
}
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define endl "\n"
#define sd(val) scanf("%d",&val)
#define ss(val) scanf("%s",&val)
#define sl(val) scanf("%lld",&val)
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long int
#define mod 1000000007
#define clr(val) memset(val,0,sizeof(val))
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector<int>sum(1000006);
void cal() {
	sum[0] = 0;
	sum[1] = 1;
	for (int i = 2; i <= 1000000; i++) {
		sum[i] = i + sum[i - 1];
	}
}
void solve() {
	int ans = 0;
	int n;
	cin >> n;
	int a, b;
	while (n--) {
		cin >> a >> b;
		ans += (sum[b] - sum[a - 1]);
	}
	cout << ans << endl;
	return;
}
int32_t main()
{
	cal();
	fio
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	//cin>>t;
	while (t--) {
		solve();
	}
	return 0;
}