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