#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    if (k >= n)
      cout << n * (n - 1) / 2 + 1 << endl;
    else
      cout << k * (k + 1) / 2 << endl;
  }
  return 0;
}
