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