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