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