#include <bits/stdc++.h>
#include <string>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
using namespace std;
// cout << fixed << setprecision(8) << result << endl;

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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <string>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;

#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define fi first
#define sc second

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsort(v) sort(v.rbegin(),v.rend())

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)

// const int MOD = 998244353;
const int MOD = 1e9+7;
const int MAX = 2147483647;     // 1<<31-1
const int MIN = -2147483648;    // 1<<31
const ll INF = 1e18;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

#define ts to_string
string ts(char c) { return string(1, c); }
string ts(bool b) { return b ? "0" : "1"; }
string ts(const char* s) { return (string)s; }
string ts(string s) { return s; }
template<class A, class B> string ts(pair<A, B> p) {
    return "("+ts(p.fi)+", "+ts(p.sc)+")";
}
template<class T> string ts(T v) { // containers with begin(), end()
    string res = "";
    for (const auto& x: v) {
        res += ts(x) + " ";
    }
    return res;
}

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
    cerr << ts(h); if (sizeof...(t)) cerr << ", ";
    DBG(t...);
}

#ifdef LOCAL
#include "../../snippits/debugger.cpp"
#define dbg(...) cerr << "L(" << __LINE__ << "): [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else 
#define dbg(...) 0
#define print_segtree(...) 0
#endif

const vector<vector<int>> dirs = { {0,1},{1,0},{-1,0},{0,-1} };

// distance from origin
struct cmp {
    bool operator()(const pii& lhs, const pii& rhs) const {
        return (abs(lhs.fi)+abs(lhs.sc))<((abs(rhs.fi)+abs(rhs.sc)));
    }
};

// getline(cin, str) for getting a line of string
// call cin.ignore() BETWEEEN cin >> x and getline()!!!
// don't mod before you sort!!!
// clear global state
// remember to %= the result!

// INITIALIZE CORRECTLY, ARE YOU DOING (i,0,*N+1*) WHEN NEEDED?
// PRIORITY QUEUES ARE SORTED BIG TO SMALL
// NEVER assign element to a reference and then pop!!!!!

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1;
    cin >> t;

    ll res = 0;
    while (t--) {
        int a, b;
        cin >> a >> b;
        res += 1LL*(a+b)*(b-a+1)/2;
    }

    cout << res << '\n';

    return 0;
}
