#include <bits/stdc++.h>
using namespace std;
long long magic(long long n, long long r) {
  long long number_of_shapes = 0;
  if (r < n)
    number_of_shapes = ((r) * (r + 1)) / 2;
  else
    number_of_shapes = (((n - 1) * n) / 2) + 1;
  return number_of_shapes;
}
int main() {
  int t;
  cin >> t;
  long long n, r;
  vector<long long> ans;
  for (int i = 0; i < t; i++) {
    cin >> n >> r;
    ans.push_back(magic(n, r));
  }
  for (long long i = 0; i < t; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}
