#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 10;
const long long INF = 1e9 + 10;
const long long MOD = 1e9 + 7;
void solve() {
  long long n, r;
  cin >> n >> r;
  if (n > r)
    cout << r * (r + 1) / 2 << '\n';
  else
    cout << n * (n - 1) / 2 + 1 << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
