#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int i, u, v, T;
  long long sum;
  scanf("%d", &T);
  while (T-- > 0) {
    scanf("%d %d", &u, &v);
    sum = 0;
    sum = (long long)(u + v) * (u + v + 1) / 2;
    sum = sum + (u + v + 1) - v;
    printf("%lld \n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jle    11cc <main+0xac>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cltq
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed1(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11c1 <main+0xa1>
lea    0xeac(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xea1(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
movslq 0x14(%rsp),%rax
movslq 0x10(%rsp),%rcx
add    %rcx,%rax
lea    0x1(%rax),%edx
movslq %edx,%rsi
imul   %rsi,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
add    %rax,%rdx
sar    %rdx
sub    %rcx,%rsi
add    %rdx,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jg     1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [7 x i8] c"%lld \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
br label %8
8: ; preds = %12, %0
%9 = load i32, i32* %5
%10 = add nsw i32 %9, -1
store i32 %10, i32* %5
%11 = icmp sgt i32 %9, 0
br i1 %11, label %12, label %37
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
store i64 0, i64* %6
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
%17 = sext i32 %16 to i64
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = mul nsw i64 %17, %22
%24 = sdiv i64 %23, 2
store i64 %24, i64* %6
%25 = load i64, i64* %6
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = add nsw i32 %26, %27
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = add nsw i64 %25, %30
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = sub nsw i64 %31, %33
store i64 %34, i64* %6
%35 = load i64, i64* %6
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 %35)
br label %8
37: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [7 x i8] c"%lld \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %28
11: ; preds = %0, %11
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = add nsw i32 %14, %13
%16 = sext i32 %15 to i64
%17 = add nsw i32 %15, 1
%18 = sext i32 %17 to i64
%19 = mul nsw i64 %18, %16
%20 = sdiv i64 %19, 2
%21 = sext i32 %14 to i64
%22 = sub nsw i64 %18, %21
%23 = add nsw i64 %22, %20
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 %23)
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
%27 = icmp sgt i32 %25, 0
br i1 %27, label %11, label %28
28: ; preds = %11, %0
ret i32 0
}