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