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