#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 5;
const long long mod = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    if (n > r) {
      long long ans;
      ans = (r + 1) * r / 2;
      cout << ans << endl;
    } else {
      long long ans = n * (n - 1) / 2 + 1;
      cout << ans << endl;
    }
  }
}
