#include <bits/stdc++.h>
using namespace std;
int solve() {
  long long int n, r;
  cin >> n >> r;
  if (n == 1) {
    cout << 1 << "\n";
    return 0;
  }
  unsigned long long int rez = 0;
  if (n > 1) {
    if (r >= n) {
      rez += (n * (n - 1)) / 2 + 1;
    } else
      rez += (1 + r) * r / 2;
  }
  cout << rez << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
