#include <bits/stdc++.h>
using namespace std;
const long long N = 1e9 + 5;
bool col2(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.second > p2.second;
}
struct comp {
  bool operator()(long long const &x, long long const &y) { return x > y; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    if (r < n) {
      cout << (r * (r + 1) / 2) << endl;
    } else {
      cout << ((n - 1) * (n) / 2) + 1 << endl;
    }
  }
}
