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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vcc = vector<vc>;
using Pii = pair<int,int>;
using ld = long double;

#define rep(i,n) for(int i = 0; i<(int)n; i++)
#define per(i,n) for(int i = n-1; i>=0; i--)
#define mysort(V) sort(V.begin(),V.end())
#define myreverse(V) reverse(V.begin(),V.end())
#define myunique(V) V.erase( unique(V.begin(), V.end()), V.end() );
#define print(s) cout << s << endl;

const ld PI = 3.14159265358979;

long long powll(long long x, long long n){
    if(n == 0) return 1;
    else       return powll(x,n-1)*x;
}

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


int main(){
    int N;
    cin >> N;
    ll ans = 0;
    for(int i = 0; i<N; i++){
        ll a,b;
        cin >> a >> b;
        ans += b*(b+1)/2;
        ans -= (a-1)*a/2;
    }
    cout << ans << endl;
}

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

int main() {
  long N, A, B, Ans=0;
  cin >> N;
  rep(i, N){
    cin >> A >> B;
    if((B-A+1)%2==0) Ans+=(A+B)*((B-A+1)/2);
    else Ans+=(A+B)*((B-A+1)/2)+(A+B)/2;
  }
  cout << Ans << endl;
}