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