#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n, r;
    cin >> n >> r;
    if (n > r) {
      long long ans = (long long)r * (long long)(r + 1);
      ans /= 2;
      cout << ans << endl;
    } else {
      long long ans = (long long)n * (long long)(n - 1);
      ans /= 2;
      cout << ans + 1 << endl;
    }
  }
}
