#include <bits/stdc++.h>
const long long MOD = 1000000007;
const long long inf = 1e18;
using namespace std;
long long int modpow(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
bool custom_sort(int &x, int &y) {
  if (x < y)
    return 1;
  else
    return 0;
}
void dragnoid99() {
  long long int n, r;
  cin >> n >> r;
  long long int n1 = min(n - 1, r) + 1;
  long long int ans = n1 * (n1 - 1) / 2;
  if (r >= n) ans++;
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1, tt = 1;
  cin >> t;
  while (tt <= t) {
    dragnoid99();
    tt++;
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
