#include <bits/stdc++.h>
int main() {
  long long n1, n2, n3;
  std::cin >> n1;
  for (int i = 0; i < n1; i++) {
    std::cin >> n2 >> n3;
    if (n2 > n3)
      std::cout << (long long)(n3 * (n3 + 1) / 2) << "\n";
    else
      std::cout << (long long)(n2 - 1) * n2 / 2 + 1 << "\n";
  }
}
