#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &o, vector<T> v) {
  if (v.size() > 0) o << v[0];
  for (unsigned i = 1; i < v.size(); i++) o << " " << v[i];
  return o << endl;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first - a.second) > (b.first - b.second);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int n, r;
    cin >> n >> r;
    long long int mxr = n - 1;
    long long int ans = 0;
    mxr = min(r, mxr);
    ans += (mxr * (mxr + 1)) / 2;
    if (mxr < r) ans++;
    cout << ans << endl;
  }
  return 0;
}
