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