#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T x) {
  cout << x << endl;
}
template <typename T1, typename T2>
void print2(T1 x, T2 y) {
  cout << x << " " << y << endl;
}
template <typename T1, typename T2, typename T3>
void print3(T1 x, T2 y, T3 z) {
  cout << x << " " << y << " " << z << endl;
}
void chandan1() {
  int y = 1;
  return;
}
void chandan2() {
  for (long long int i = 0; i < 10; i++) {
    long long int x = 1;
  }
  return (chandan1());
}
long long int mceil(long long int a, long long int b) {
  if (a % b == 0)
    return (a / b);
  else
    return (a / b + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  chandan2();
  while (t--) {
    long long int n, r;
    cin >> n >> r;
    long long int ans = 0;
    if (n >= r) {
      ans = (r * (r + 1)) / 2;
      if (n == r) ans = ans - r + 1;
    } else {
      long long int mini = min(n, r) - 1;
      ans = 1 + (mini * (mini + 1) / 2);
    }
    print(ans);
  }
  return 0;
}
