Chef has a rectangular plate of length  N cm  and width M cm. He wants to make a wireframe around the plate. The wireframe costs X rupees per cm. 

Determine the cost Chef needs to incur to buy the wireframe.

------ Input Format ------ 

- First line will contain T, the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, containing three space-separated integers N,M, and X — the length of the plate, width of the plate, and the cost of frame per cm.

------ Output Format ------ 

For each test case, output in a single line, the price Chef needs to pay for the wireframe.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ N,M,X ≤ 1000 $

----- Sample Input 1 ------ 
3
10 10 10
23 3 12
1000 1000 1000

----- Sample Output 1 ------ 
400
624
4000000
----- explanation 1 ------ 
Test case $1$: The total length of the frame is $2\cdot 10 + 2\cdot 10 = 40$ cms. Since the cost is $10$ per cm, the total cost would be $10 \cdot 40 = 400$.

Test case $2$: The total length of the frame is $2\cdot 23 + 2\cdot 3 = 52$ cms. Since the cost is $12$ per cm, the total cost would be $52 \cdot 12 = 624$.

Test case $3$: The total length of the frame is $2\cdot 1000 + 2\cdot 1000 = 4000$ cms. Since the cost is $1000$ per cm, the total cost would be $4000 \cdot 1000 = 4000000$.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
t = int(input())
for i in range(t):
	(n, m, x) = map(int, input().split())
	perimeter = 2 * (n + m)
	cost = perimeter * x
	print(cost)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	print((x + y) * 2 * z)


n = int(input())
for _ in range(n):
	(a, b, c) = map(int, input().split())
	a1 = 2 * a
	b1 = 2 * b
	c1 = a1 + b1
	print(c1 * c)


t = int(input())
for t in range(t):
	(n, m, x) = map(int, input().split())
	a = 2 * n + 2 * m
	print(a * x)


for i in range(int(input())):
	(n, m, x) = map(int, input().split())
	print(2 * (n + m) * x)


for _ in range(int(input())):
	(x, y, z) = list(map(int, input().split()))
	l = (2 * x + 2 * y) * z
	print(l)


for i in range(int(input())):
	(n, w, x) = map(int, input().split())
	a = 2 * n + 2 * w
	print(x * a)


t = int(input())
for i in range(t):
	(n, m, x) = [int(x) for x in input().split()]
	total = 2 * n + 2 * m
	print(total * x)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	x = 2 * a + 2 * b
	print(x * c)


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	d = a * 2 + b * 2
	print(d * c)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	d = 2 * a + 2 * b
	e = d * c
	print(e)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print(2 * (a + b) * c)


T = int(input())
for i in range(T):
	(n, m, x) = map(int, input().split())
	length = 2 * n + 2 * m
	wireframe = x * length
	print(wireframe)


n = int(input())
for i in range(n):
	m = input().split()
	print((int(m[0]) * 2 + int(m[1]) * 2) * int(m[2]))


for T in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	C = 2 * (X + Y)
	print(C * Z)


n = int(input())
for i in range(n):
	(k, j, l) = map(int, input().split())
	print((2 * k + 2 * j) * l)


T = int(input())
for i in range(T):
	(N, M, X) = map(int, input().split())
	a = 2 * N + 2 * M
	print(a * X)


t = int(input())
for i in range(0, t):
	(a, b, c) = map(int, input().split())
	res = a * 2 + b * 2
	print(res * c)


for i in range(int(input())):
	(x, y, c) = map(int, input().split())
	print(2 * (x + y) * c)


t = int(input())
while t:
	(n, m, x) = map(int, input().split())
	print(2 * n * x + 2 * m * x)
	t -= 1


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	m = 2 * x + 2 * y
	print(m * z)


i = int(input(''))
j = 0
while j < i:
	(x, y, z) = map(int, input('').split())
	op = (2 * x + 2 * y) * z
	j += 1
	print(op)


a = int(input())
while a != 0:
	(x, y, z) = map(int, input().split())
	print(z * (2 * x + 2 * y))
	a -= 1


t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	print((2 * X + 2 * Y) * Z)


T = int(input())
for i in range(T):
	(N, M, X) = map(int, input().split())
	total_length = 2 * N + 2 * M
	total_cost = total_length * X
	print(total_cost)


t = int(input())
for i in range(t):
	(n, m, x) = map(int, input().split())
	total_length = 2 * (n + m)
	total_cost = total_length * x
	print(total_cost)


n = int(input())
for i in range(n):
	(n1, n2, n3) = map(int, input().split())
	print((2 * n1 + 2 * n2) * n3)


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	out = 2 * a + 2 * b
	out1 = out * c
	print(out1)


n = int(input())
for _ in range(n):
	(x, y, z) = map(int, input().split())
	a = 2 * x + 2 * y
	print(a * z)


for i in range(int(input())):
	(N, M, X) = map(int, input().split())
	amount_to_pay = (2 * N + 2 * M) * X
	print(amount_to_pay)


number = int(input())
for i in range(number):
	(a, b, c) = map(int, input().split())
	a = 2 * a
	b = 2 * b
	d = a + b
	e = c * d
	print(e)


t = int(input())
for i in range(0, t):
	(n, m, x) = map(int, input().split())
	print((n + n + m + m) * x)


n = int(input())
for i in range(n):
	(x, y, z) = map(int, input().split())
	length = 2 * (x + y)
	cost = length * z
	print(cost)


t = int(input())
for i in range(t):
	(x, n, m) = map(int, input().split())
	c = 2 * x + 2 * n
	e = c * m
	print(e)


t = int(input())
i = 1
while i <= t:
	(N, M, X) = list(map(int, input().split()))
	s = 2 * N + 2 * M
	v = s * X
	print(v)
	i = i + 1


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	n1 = 2 * (a + b)
	n2 = n1 * c
	print(n2)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split(' '))
	perimeter = 2 * X + 2 * Y
	totalCost = perimeter * Z
	print(totalCost)


t = int(input())
for i in range(t):
	(N, M, X) = map(int, input().split())
	area = 2 * N + 2 * M
	cost = area * X
	print(cost)


for i in range(int(input())):
	(x, y, n) = map(int, input().split())
	s = 2 * x + 2 * y
	print(s * n)


t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	k = 2 * x + 2 * y
	s = k * z
	print(s)


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))[:3]
	print((lst[0] * 2 + lst[1] * 2) * lst[2])


n = int(input())
for i in range(n):
	(x, y, z) = input().split()
	x = int(x)
	y = int(y)
	z = int(z)
	print(2 * (x + y) * z)


t = int(input())
for i in range(t):
	(n, m, x) = list(map(int, input().split()))
	s = 2 * m + 2 * n
	r = s * x
	print(r)


for _ in range(int(input())):
	(a, b, c) = [int(x) for x in input().split()]
	q = 2 * (a + b) * c
	print(q)