#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    long long mx = min(n - 1, r);
    long long tot = mx * (mx + 1) / 2;
    if (mx == r)
      cout << tot << "\n";
    else
      cout << tot + 1 << "\n";
  }
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
