#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, a, b, m;
    cin >> n >> m;
    long long ans = 0;
    if (m < n) {
      ans = (m * (m + 1)) / 2;
      cout << ans << "\n";
    } else {
      ans = (n * (n - 1)) / 2 + 1;
      cout << ans << "\n";
    }
  }
  return 0;
}
