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