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