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