#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long solve() {
  int n, r;
  cin >> n >> r;
  long long ans;
  long long k = min(n, r) - 1;
  ans = k * (k + 1) / 2;
  if (n <= r)
    ans += 1;
  else
    ans += r;
  return ans;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << endl;
  }
  return 0;
}
