#include <bits/stdc++.h>
using namespace std;
using  ll = long long;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
  int n;
  std::cin >> n;

  ll ans=0;
  rep(i,n){
    ll a,b;
    std::cin >> a>>b;

    ll add=(a+b)*(b-a+1)/2;
    ans+=add;
  }
  std::cout << ans << '\n';

  return 0;
}

#include<iostream>
using namespace std;
const int N=1e6+10;
int a[N];
int main(){
	int n;
	cin>>n;
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]>10){
			sum=sum+(a[i]-10);
		}
	}
	cout<<sum;
	return 0;
}