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