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