import java.io.*;
import java.util.*;

public class Charlie {
    public static void main(String[] args) throws IOException {
        BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

        int testCase = Integer.parseInt(inp.readLine());

        for(int t=0;t<testCase;t++){

            String[] s1 = inp.readLine().split(" ");
            long a = Long.parseLong(s1[0]);
            long b = Long.parseLong(s1[1]);

            long c = Math.min(a,b*2+1);

            c = c*(c-1);
            c/=2;
            c += b;

            System.out.println(c);

        }

    }
}
