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