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