#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t-- > 0) {
    long long n, r;
    cin >> n >> r;
    long long save = r;
    r = min(r, n - 1);
    long long total = (r * (r + 1)) / 2;
    total = max(total, (long long)0);
    long long ans = total;
    if (n <= save) {
      ans++;
    }
    cout << ans << endl;
  }
}
