#include <bits/stdc++.h>
int main() {
  int T;
  scanf("%d", &T);
  for (int tc = 1; tc <= T; ++tc) {
    int n, r;
    scanf("%d%d", &n, &r);
    printf("%lld\n",
           (long long int)(std::min(r + 1, n) - 1) * std::min(r + 1, n) / 2 +
               !!(r >= n));
  }
  return 0;
}
