#include <bits/stdc++.h>
using namespace std;
long long T, n, r;
signed main() {
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld%lld", &n, &r);
    n = min(r + 1, n);
    if (n == r + 1)
      printf("%lld\n", n * (n - 1) / 2);
    else
      printf("%lld\n", 1 + n * (n - 1) / 2);
  }
  return 0;
}
