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