#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;
using vii = vector<pii>;
int solve();
int main(int argc, char* argv[]) {
  ::std::ios::sync_with_stdio(false);
  ::std::cin.tie(0);
  ::std::cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
int solve() {
  int N, R;
  cin >> N >> R;
  if (N == 1 || R == 1) {
    cout << 1 << '\n';
    return 0;
  }
  if (N > R) {
    cout << (1LL + R) * 1LL * R / 2 << '\n';
    return 0;
  }
  cout << N * 1LL * (N - 1LL) / 2 + 1 << '\n';
  return 0;
}
