#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, long long);
scalar_t__ scanf(char *, int *);
int main() {
  int i, j, k, n, m, u, ar[100000];
  long long S;
  while (scanf("%d", &n) != EOF) {
    for (m = 1; m <= n; m++) {
      scanf("%d", &k);
      S = 0;
      for (u = 1; u <= k; u++) {
        scanf("%d", &ar[u]);
        if (ar[u] % 2 == 0)
          S += ar[u];
        else
          S -= ar[u];
      }
      printf("%lld\n", S);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%rax
je     1242 <main+0x122>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     123d <main+0x11d>
lea    0xe94(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x61aa8(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     121c <main+0xfc>
movslq -0x1c(%rbp),%rax
lea    -0x61aa0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe54(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x1c(%rbp),%rax
mov    -0x61aa0(%rbp,%rax,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ec <main+0xcc>
movslq -0x1c(%rbp),%rax
movslq -0x61aa0(%rbp,%rax,4),%rax
ff
add    -0x61aa8(%rbp),%rax
mov    %rax,-0x61aa8(%rbp)
jmp    1209 <main+0xe9>
movslq -0x1c(%rbp),%rax
movslq -0x61aa0(%rbp,%rax,4),%rcx
ff
mov    -0x61aa8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x61aa8(%rbp)
jmp    120e <main+0xee>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <main+0x67>
mov    -0x61aa8(%rbp),%rsi
lea    0xdd9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1159 <main+0x39>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61a98,%rsp
lea    0xec8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%rax
jne    1162 <main+0x42>
xor    %eax,%eax
add    $0x61a98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x14(%rsp),%r14
lea    0xe92(%rip),%r13
jmp    1189 <main+0x69>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%rax
je     114e <main+0x2e>
cmpl   $0x0,0x8(%rsp)
jle    1170 <main+0x50>
mov    $0x1,%ebp
jmp    11bc <main+0x9c>
nopw   0x0(%rax,%rax,1)
xor    %ebx,%ebx
lea    0xe5a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x1(%rbp),%eax
cmp    0x8(%rsp),%ebp
mov    %eax,%ebp
jge    1170 <main+0x50>
mov    %r13,%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11a0 <main+0x80>
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r14,%r15,1),%rsi
mov    %r13,%rdi
call   1040 <scanf@plt>
movslq 0x14(%rsp,%r12,4),%rax
mov    %rax,%rcx
neg    %rcx
test   $0x1,%al
cmove  %rax,%rcx
add    %rcx,%rbx
movslq 0xc(%rsp),%rax
add    $0x1,%r12
add    $0x4,%r15
cmp    %rax,%r12
jl     11e0 <main+0xc0>
jmp    11a2 <main+0x82>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 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 i32
%7 = alloca i32
%8 = alloca [100000 x i32]
%9 = alloca i64
store i32 0, i32* %1
br label %10
10: ; preds = %62, %0
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %63
14: ; preds = %10
store i32 1, i32* %6
br label %15
15: ; preds = %59, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %62
19: ; preds = %15
%20 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i64 0, i64* %9
store i32 1, i32* %7
br label %21
21: ; preds = %53, %19
%22 = load i32, i32* %7
%23 = load i32, i32* %4
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %56
25: ; preds = %21
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100000 x i32], [100000 x i32]* %8, i64 0, i64 %27
%29 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %28)
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100000 x i32], [100000 x i32]* %8, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = srem i32 %33, 2
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %25
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100000 x i32], [100000 x i32]* %8, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = sext i32 %40 to i64
%42 = load i64, i64* %9
%43 = add nsw i64 %42, %41
store i64 %43, i64* %9
br label %52
44: ; preds = %25
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100000 x i32], [100000 x i32]* %8, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = sext i32 %48 to i64
%50 = load i64, i64* %9
%51 = sub nsw i64 %50, %49
store i64 %51, i64* %9
br label %52
52: ; preds = %44, %36
br label %53
53: ; preds = %52
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %21
56: ; preds = %21
%57 = load i64, i64* %9
%58 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %57)
br label %59
59: ; preds = %56
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %15
62: ; preds = %15
br label %10
63: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100000 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [100000 x i32]* %3 to i8*
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %44, label %14
10: ; preds = %38, %14
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i64, i64* @EOF
%13 = icmp eq i64 %11, %12
br i1 %13, label %44, label %14
14: ; preds = %0, %10
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 1
br i1 %16, label %10, label %17
17: ; preds = %14, %38
%18 = phi i32 [ %41, %38 ], [ 1, %14 ]
%19 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = icmp slt i32 %20, 1
br i1 %21, label %38, label %22
22: ; preds = %17, %22
%23 = phi i64 [ %34, %22 ], [ 1, %17 ]
%24 = phi i64 [ %33, %22 ], [ 0, %17 ]
%25 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %23
%26 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%27 = load i32, i32* %25
%28 = and i32 %27, 1
%29 = icmp eq i32 %28, 0
%30 = sext i32 %27 to i64
%31 = sub nsw i64 0, %30
%32 = select i1 %29, i64 %30, i64 %31
%33 = add i64 %32, %24
%34 = add nuw nsw i64 %23, 1
%35 = load i32, i32* %1
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %23, %36
br i1 %37, label %22, label %38
38: ; preds = %22, %17
%39 = phi i64 [ 0, %17 ], [ %33, %22 ]
%40 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %39)
%41 = add nuw nsw i32 %18, 1
%42 = load i32, i32* %2
%43 = icmp slt i32 %18, %42
br i1 %43, label %17, label %10
44: ; preds = %10, %0
ret i32 0
}