#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    if (r < n)
      cout << (r * (r + 1)) / 2 << "\n";
    else
      cout << (((n - 1) * n) / 2) + 1 << "\n";
  }
  return 0;
}
