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

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

    auto go = [&](int x) -> long long {
        return 1LL * x * (x + 1) / 2;
    };

    long long ans = 0;
    while (n--) {
        int a, b;
        cin >> a >> b;
        ans += go(b) - go(a - 1);
    }
    cout << ans << "\n";
    return 0;
}


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


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

    ll ans = 0;

    int n; cin >> n;
    rep(i,n){
        ll a,b; cin >> a >> b;
        ans += (a+b)*(b-a+1)/2;
    }

    cout << ans << endl;

}