#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int a, b, ans = 0, sum = 0;
    cin >> a >> b;
    for (int i = 0; i < a; ++i) {
      ans += sum;
      sum++;
    }
    if (b != 0)
      cout << ans + b;
    else
      cout << 0;
  }
}
