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