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