#include <bits/stdc++.h>
int main() {
  unsigned long long i, j, t, n, r;
  unsigned long long count = 0;
  scanf("%llu", &t);
  for (i = 0; i < t; i++) {
    count = 0;
    scanf("%llu %llu", &n, &r);
    if (n > r) {
      count = (r * (r + 1) / 2);
    } else {
      n = n - 1;
      count = (n * (n + 1) / 2) + 1;
    }
    printf("%llu\n", count);
  }
  return 0;
}
