#include <bits/stdc++.h>
using namespace std;
long long powN(long long a, long long p) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2);
  z = (z * z) % 1000000007;
  if (p % 2) z = (z * a) % 1000000007;
  return z;
}
long long powN(long long a, long long p, long long md) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2, md);
  z = (z * z) % md;
  if (p % 2) z = (z * a) % md;
  return z;
}
long long modinverse(long long n, long long p) { return (powN(n, p - 2)); }
long long ncr(long long n, long long r) {
  long long p = 1000000007;
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return ((fac[n] * (modinverse(fac[r], p) % p)) % p *
          modinverse(fac[n - r], p) % p) %
         p;
}
long long int parent[200005];
long long int ssize[200005];
void make_set(int v) {
  parent[v] = v;
  ssize[v] = 1;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (ssize[a] < ssize[b]) swap(a, b);
    parent[b] = a;
    ssize[a] += ssize[b];
  }
}
int r[2900005];
bool prime[2900005];
void sieve(long long int n) {
  for (int i = 1; i <= n; ++i) prime[i] = true;
  prime[1] = prime[0] = false;
  r[1] = 1;
  for (long long int i = 2; i <= n; ++i) {
    if (prime[i]) {
      r[i] = i;
      for (long long int j = i; i * j <= n; ++j) {
        if (prime[j * i]) r[j * i] = i;
        prime[j * i] = false;
      }
    }
  }
}
void bfs(int s, vector<int> adj[], int n, int p[], int d[]) {
  p[s] = s;
  queue<int> q;
  q.push(s);
  d[s] = 0;
  vector<bool> visited(n + 1, false);
  visited[s] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < int((adj[u]).size()); ++i) {
      int v = adj[u][i];
      if (!visited[v]) {
        q.push(v);
        visited[v] = true;
        p[v] = u;
        d[v] = d[u] + 1;
      }
    }
  }
}
typedef struct {
  long long int p, x, y, z;
} pt;
int n;
void add(int id, long long int val, long long int BIT[]) {
  while (id <= n) {
    BIT[id] += val;
    id = id + (id & (-id));
  }
}
long long int query(int id, long long int BIT[]) {
  long long int result = 0;
  while (id > 0) {
    result += BIT[id];
    id = id - (id & (-id));
  }
  return (result);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n, r;
    cin >> n >> r;
    if (n > r)
      cout << (r * (r + 1)) / 2 << endl;
    else {
      cout << (n * (n - 1)) / 2 + 1 << endl;
    }
  }
}
