#include <bits/stdc++.h>
using namespace std;
int const mod = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long mn = min(a, b);
    long long ans = (mn * (mn + 1)) / 2;
    if (b >= a) {
      mn--;
      ans = (mn * (mn + 1)) / 2;
      ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
