#include <bits/stdc++.h>
using namespace std;
long long fx[4] = {1, -1, 0, 0};
long long fy[4] = {0, 0, 1, -1};
int smallest(int x, int y, int z) {
  int c = 0;
  while (x && y && z) {
    x--;
    y--;
    z--;
    c++;
  }
  return c;
}
bool rs(long long a, long long b) { return (a > b); }
vector<long long> v;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, r;
    cin >> n >> r;
    long long m = min(n, r);
    long long s = (m * (m + 1)) / 2;
    if (n > r) {
      cout << s << endl;
    } else if (n == r) {
      cout << s - m + 1 << endl;
    } else {
      s = s - m + 1;
      cout << s << endl;
    }
  }
  return 0;
}
