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