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