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