#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 *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int a, b, c, n, i;
  int total;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d", &a, &b, &c);
    total = c * (a + (a - b)) / (a + b);
    printf("%d\n", total);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a8 <main+0x88>
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    -0x8(%rbp),%edx
sub    -0xc(%rbp),%edx
add    %edx,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed1(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11ad <main+0x8d>
lea    0xeb1(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0xea4(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%esi
lea    (%rcx,%rcx,1),%eax
sub    %esi,%eax
imul   0xc(%rsp),%eax
add    %ecx,%esi
cltd
idiv   %esi
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0x8(%rsp),%ebp
jl     1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [4 x i8] c"%d\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
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 1, i32* %6
br label %9
9: ; preds = %28, %0
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%15 = load i32, i32* %4
%16 = load i32, i32* %2
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = add nsw i32 %16, %19
%21 = mul nsw i32 %15, %20
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = add nsw i32 %22, %23
%25 = sdiv i32 %21, %24
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %13
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %9
31: ; preds = %9
ret i32 0
}

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