#include <bits/stdc++.h>
using namespace std;
int t;
long n, m;
int main() {
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> n >> m;
    if (m == 0) {
      cout << 0 << endl;
      continue;
    }
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    cout << (n * (n - 1) / 2) + m << endl;
  }
  return 0;
}
