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