#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-4;
const int mod = 1e9 + 7;
const int N = 1 << 12;
int main() {
  int tt;
  cin >> tt;
  while (tt--) {
    long long n, m;
    cin >> n >> m;
    if (m < n)
      cout << (1 + m) * m / 2 << endl;
    else
      cout << n * (n - 1) / 2 + 1 << endl;
  }
  return 0;
}
