#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, r, minn;
    cin >> n >> r;
    if (r < n)
      minn = r;
    else
      minn = n - 1;
    long long int ans = 0;
    ans = (minn * (minn + 1)) / 2;
    if (minn == n - 1 && minn < r) ans++;
    cout << ans << endl;
  }
}
