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