#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n, r;
    cin >> n >> r;
    long long cnt = 0;
    long long qw = min(r, n);
    if (r >= n) {
      cnt++;
      qw--;
    }
    cnt += qw * (qw + 1) / 2;
    cout << cnt << "\n";
  }
  return 0;
}
