#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef complex<double> comp;
const ll INF=1e9+7;
const ll inf=INF*INF;
const ll MOD=1e9+7;
const ll mod=MOD;
const int MAX=200010;

signed main(){
    ll n;cin>>n;
    ll ans=0;
    rep(i,n){
        ll a;cin>>a;
        ll b;cin>>b;
        ans+=b*(b+1)/2;
        ans-=a*(a-1)/2;
    }
    cout<<ans<<endl;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long int
//int arr[500000]
int make_tuple(int l,int r)
{ int y= r-2*l+1;
       if(y<0) return 0;
   return (y*(y+1))/2;       
}
int find_ans()
{ int l,r,ans;
 cin>>l>>r;
 
 ans= make_tuple(l,r);
return ans;    
}
 
int32_t main()
{ 
   
    int t;
cin>>t;
 while(t>0)
 { cout<<find_ans()<<"\n";
    t--; 
 }
    return 0;
}
