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