#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 6, K = 20;
long long s(long long x) { return (x * (x + 1)) / 2; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, r, ans;
    cin >> n >> r;
    if (r >= n)
      ans = s(n - 1) + 1;
    else
      ans = s(r);
    cout << ans << "\n";
  }
}
