#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3F3F3F3F;
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;
const int maxn = 3e3 + 10;
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
ll C2(ll x) { return x * (x + 1) / 2; }
int main() {
  ios::sync_with_stdio(false);
  int test;
  cin >> test;
  while (test--) {
    ll n, r;
    cin >> n >> r;
    if (r < n) {
      cout << C2(r) << endl;
    } else {
      cout << (C2(n - 1) + 1) << endl;
    }
  }
  return 0;
}
