#include <bits/stdc++.h>
using namespace std;
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return gcd(b % a, a);
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return (a * b) / gcd(a, b);
}
unsigned long long nCr(unsigned long long n, unsigned long long r) {
  unsigned long long p = 1, k = 1;
  if (n - r < r) r = n - r;
  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      unsigned long long m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else
    p = 1;
  return p;
}
long long power(long long b, long long p, long long m) {
  if (!p) return 1;
  if (p % 2) return (b * power(b, p - 1, m)) % m;
  unsigned long long x = power(b, p / 2, m);
  return (x * x) % m;
}
struct dsu {
  int n;
  vector<int> rank;
  vector<int> parent;
  vector<int> sz;
  dsu(int x) {
    n = x;
    for (int i = 0; i <= n; i++) {
      parent.push_back(i);
      rank.push_back(1);
      sz.push_back(1);
    }
  }
  int find(int x) {
    if (parent[x] == x) return x;
    return parent[x] = find(parent[x]);
  }
  void link(int x, int y) {
    int px = find(x), py = find(y);
    if (px == py) return;
    if (rank[px] > rank[py]) {
      parent[py] = px;
      sz[px] += sz[py];
    } else if (rank[py] > rank[px]) {
      parent[px] = py;
      sz[py] += sz[px];
    } else {
      rank[px]++;
      sz[px] += sz[py];
      parent[py] = px;
    }
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long n, r, mn, d;
    cin >> n >> r;
    mn = min(r, n - 1);
    d = r > mn ? 1 : 0;
    cout << mn * (mn + 1) / 2 + d << endl;
  }
  return 0;
}
