#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, d = 0, a = 1, k, x, y, i, b, ps = 0, ng = 0, cnt = 0;
    string s, p;
    cin >> n >> k;
    if (n <= k)
      cnt = ((n * (n - 1)) / 2) + 1;
    else
      cnt = (k * (k + 1)) / 2;
    cout << cnt << endl;
  }
  return 0;
}
