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