#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long inf = 1e18, mod = 1e9 + 7;
long long q, a[N], n, ans, m;
string s, t;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> q;
  while (q--) {
    ans = 0;
    cin >> n >> m;
    if (n > m)
      ans = (m * (m + 1)) / 2;
    else
      ans = ((n - 1) * (n)) / 2, ans++;
    cout << ans << endl;
  }
}
