#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  getchar();
  while (t--) {
    long long int n, m, sum = 0, k;
    scanf("%lld %lld", &n, &m);
    getchar();
    if (n <= m) {
      if ((n - 1) % 2 == 0) {
        n--;
        n = ((n / 2) * (n - 1)) + n;
        n++;
      } else {
        n--;
        n = (((n - 1) / 2) * (n)) + n;
        n++;
      }
      printf("%lld\n", n);
    } else {
      if (m % 2 == 0) {
        m = ((m / 2) * (m - 1)) + m;
      } else {
        m = (((m - 1) / 2) * (m)) + m;
      }
      printf("%lld\n", m);
    }
  }
}
