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