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