#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;

ull gcd (ull a, ull b) {
  if(b == 0) return a;

  return gcd(b, a % b);
}

ull lcm (ull a, ull b){
  // バッファ溢れを抑えるために順番大事！！！
  return a / gcd(a, b) * b;
}

ull calcDigits(ull n, int count) {
  if(n < 10) return count + 1;

  return calcDigits(n/10, count+1);
}

int main () {
  ll n, a, b, res=0;
  cin >> n;

  for(ll i =0; i < n; ++i) {
    cin >> a >> b;

    if((b - a) % 2 == 1) {
      res += (a+b) * (b-a+1) /2;
    } else {
      res += (a+b-1) * ((b-a+1) / 2)  + b;
    }
  }

  cout << res << endl;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
#include <math.h>
using namespace std;


#define nl <<endl
#define cy cout<<"Yes" nl
#define cn cout<<"No" nl
#define co(x) cout<<x nl
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpe(i,a,b) for(i=a;i<=b;i++)

int main() {
    int i;
    unsigned long long n;
    cin>>n;
    long j,a,b,count=0;
    
    lp(i,0,n){
        cin>>a>>b;
        count+=(b-a+1)*(a+b)/2;
    }
    
    cout<<count nl;
    
    return 0;
}
