#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const ll N = 1e5 + 5, p1 = 911382323, p2 = 972663749, mod = 1e9 + 123;
inline int read() {
  char c = getchar();
  bool minus = 0;
  while (c < '0' || '9' < c) {
    if (c == '-') {
      minus = 1;
    }
    c = getchar();
    if (c == '-') {
      minus = 1;
    }
  }
  int res = 0;
  while ('0' <= c && c <= '9') {
    res = (res << 3) + (res << 1) + c - '0';
    c = getchar();
  }
  if (minus) {
    res *= -1;
  }
  return res;
}
void solve() {
  ll n, r;
  cin >> n >> r;
  ll ans = 0;
  if (r < n) {
    ans += (r * (r + 1)) / 2;
  } else {
    ans += (n * (n - 1)) / 2 + 1;
  }
  cout << ans;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    solve();
    cout << "\n";
  }
  return 0;
}
