#include <bits/stdc++.h>
using namespace std;
long long t, n, k, temp, sum;
vector<int> vec;
int main() {
  cin >> t;
  for (long long r = 0; r < t; r++) {
    cin >> n >> k;
    if (k < n) {
      sum = ((k + 1) * k) / 2;
    } else {
      sum = ((n - 1) * n) / 2 + 1;
    }
    cout << sum << "\n";
  }
  return 0;
}
