#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    long long x = min(n, r);
    long long ans = (x) * (x - 1) / 2;
    if (x == r && x != n)
      ans += x;
    else
      ans += 1;
    cout << ans << '\n';
  }
}
