#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
set<long long int> s1;
set<long long int> s2;
set<string> st2;
vector<long long int> v1;
vector<long long int> v2;
vector<long long int> v3;
vector<long long int> v4;
vector<long long int> v5;
vector<pair<long long int, long long int> > v6;
vector<pair<long long int, long long int> > v16;
vector<string> v7;
vector<string> v8;
vector<char> v9;
vector<double> v11;
list<long long int> l;
int main() {
  long long int t;
  cin >> t;
  while (t-- > 0) {
    long long int n, r;
    cin >> n >> r;
    if (n > r) {
      cout << (r * (r + 1)) / 2 << endl;
    } else if (n <= r) {
      long long int r1 = n - 1;
      long long int a1 = (r1 * (r1 + 1)) / 2;
      a1 = a1 + 1;
      cout << a1 << endl;
    }
  }
  return 0;
}
