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