#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast")
using namespace std;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
const int inf = 2e9 + 7;
double eps = 1e-6;
const int mod = 7;
const int N = 1e6 + 10;
const double pi = acos(-1.0);
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
void add(long long& a, long long b) {
  a += b;
  ((a >= mod) && (a -= mod));
  ((a < 0) && (a += mod));
}
int len, C[N], clen;
int id(int v) { return lower_bound(C + 1, C + len, v) - C; }
void initC() {
  sort(C + 1, C + clen);
  len = unique(C + 1, C + 1 + clen) - C - 1;
}
int main() {
  ios::sync_with_stdio(false);
  int _;
  cin >> _;
  while (_--) {
    unsigned long long n, r;
    cin >> n >> r;
    unsigned long long res = 0;
    unsigned long long up = min(n - 1, r);
    res += up * (up + 1) / 2;
    if (up < r) res++;
    cout << res << '\n';
  }
}
