#include <bits/stdc++.h>
using namespace std;
void func() {
  long long n, r;
  cin >> n >> r;
  if (r < n) {
    long long ans = (r * (r + 1)) / 2;
    cout << ans;
    cout << "\n";
  } else {
    long long ans = 1 + (n * (n - 1)) / 2;
    cout << ans;
    cout << "\n";
  }
}
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  }
  long long ntc = 1;
  cin >> ntc;
  for (long long i = 1; i < ntc + 1; i++) {
    func();
  }
  return 0;
}
