There are two types of vehicles in Chefland.
Bus which has a capacity of 100 people.
Car which has a capacity of 4 people.

There are N people who want to travel from place A to place B. You know that a single bus emits X units of smoke while a single car emits Y units of smoke in their journey from A to B.

You want to arrange some buses and cars to carry all these N people such that total smoke emitted is minimized. Output the minimized smoke value.

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

- First line will contain T, the number of test cases. Then the test cases follow.
- Each test case contains three integers N, X, Y - the number of people who want to travel, the units of smoke emitted by a bus and the units of smoke emitted by a car respectively.

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

For each test case, output the minimum units of smoke emitted in transporting the N people.

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

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

----- Sample Input 1 ------ 
3
9 40 8
15 20 20
105 80 10

----- Sample Output 1 ------ 
24
20
100

----- explanation 1 ------ 
Test case-1: In the optimal case, we will use $3$ cars where the $1$-st and $2$-nd car will carry $4$ people each and the $3$-rd car will carry $1$ person.

Therefore smoke emitted $= 3 \times 8 = 24$ units. 

Test case-2: In the optimal case, we will use $1$ bus to carry all the $15$ people.

Therefore smoke emitted $= 1 \times 20 = 20$ units.

Test case-3: In the optimal case, we will use $1$ bus to carry $100$ people and use $2$ cars to carry the remaining $5$ people.

Therefore smoke emitted $= 1 \times 80 + 2 \times 10 = 100$ units.

Difficulty: MEDIUM

Solutions:
from math import ceil
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	print(min(ceil(n / 4) * b, n // 100 * a + ceil(n % 100 / 4) * b, ceil(n / 100) * a))


import math
for _ in range(int(input())):
	(p, b, c) = map(int, input().split())
	if c * 25 < b:
		print(math.ceil(p / 4) * c)
	elif c == b:
		print(math.ceil(p / 100) * b)
	else:
		tb = math.ceil(p // 100)
		tc = math.ceil(p % 100 / 4)
		poll = tb * b + min(b, c * tc)
		print(poll)


for tc in range(int(input())):
	(n, b, c) = map(int, input().split())
	if b <= c:
		if n % 100 != 0:
			pol = b * (n // 100 + 1)
		else:
			pol = b * (n // 100)
	elif b / 25 > c:
		if n % 4 != 0:
			pol = c * (n // 4 + 1)
		else:
			pol = c * (n // 4)
	else:
		pol = b * (n // 100)
		rem = n % 100
		buscost = b
		if rem % 4 != 0:
			carcost = c * (rem // 4 + 1)
		else:
			carcost = c * (rem // 4)
		pol += min(buscost, carcost)
	print(pol)


import math
for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	a = math.floor(x / 100) * y + math.ceil(x % 100 / 4) * z
	b = math.ceil(x / 4) * z
	c = math.ceil(x / 100) * y
	print(int(min(a, b, c)))


import math

def get_minimized_smoke(number_of_people, smoke_from_bus, smoke_from_car):
	bus_capacity = 100
	car_capacity = 4
	smoke_contrib_by_person_via_bus = smoke_from_bus / bus_capacity
	smoke_contrib_by_person_via_car = smoke_from_car / car_capacity
	number_of_trips_via_car = math.ceil(number_of_people / car_capacity)
	smoke = 0
	while number_of_people > 0:
		if smoke_contrib_by_person_via_bus * bus_capacity < smoke_contrib_by_person_via_car * car_capacity * min(number_of_trips_via_car, 25):
			smoke += smoke_from_bus
			number_of_people -= bus_capacity
			number_of_trips_via_car = math.ceil(number_of_people / car_capacity)
		else:
			smoke += smoke_from_car
			number_of_people -= car_capacity
			number_of_trips_via_car = math.ceil(number_of_people / car_capacity)
	return smoke
number_of_test_cases = int(input())
for _ in range(number_of_test_cases):
	(number_of_people, smoke_from_bus, smoke_from_car) = [*map(int, input().split())]
	print(get_minimized_smoke(number_of_people, smoke_from_bus, smoke_from_car))


from math import ceil
T = int(input())
for _ in range(T):
	(n, x, y) = map(int, input().split(' '))
	num_cars_to_bus = x // y
	peeps_max = num_cars_to_bus * 4
	person_ratio_car = y / 4
	person_ratio_bus = x / 100
	num_cars = 0
	num_bus = 0
	if person_ratio_bus < person_ratio_car:
		num_bus = n // 100
		leftover = n % 100
		if leftover <= peeps_max:
			num_cars = ceil(leftover / 4)
		else:
			num_bus += 1
	else:
		num_cars = ceil(n / 4)
	print(num_bus * x + num_cars * y)


from copyreg import remove_extension

def option_1(n, bus, car):
	no_of_buses = int(n / 100)
	rem = n % 100
	not_full_bus = 0
	if rem != 0:
		not_full_bus = 1
	cars_for_rem = int(rem / 4)
	not_full_car = 1 if rem % 4 != 0 else 0
	cars_for_rem = cars_for_rem + not_full_car
	best = min(no_of_buses * bus + cars_for_rem * car, (no_of_buses + not_full_bus) * bus)
	return best

def option_2(n, bus, car):
	no_of_cars = int(n / 4)
	rem = n % 4
	not_full_car = 0
	if rem != 0:
		not_full_car = 1
	bus_for_rem = int(rem / 100)
	not_full_bus = 1 if rem % 100 != 0 else 0
	bus_for_rem = bus_for_rem + not_full_bus
	best = min(no_of_cars * car + bus_for_rem * bus, (no_of_cars + not_full_car) * car)
	return best
t = int(input())
for _ in range(t):
	(n, bus, car) = map(int, input().split())
	best = min(option_1(n, bus, car), option_2(n, bus, car))
	print(best)


t = int(input())
while t:
	(n, b, c) = map(int, input().split())
	(p, r) = (n, n)
	if n % 100 == 0:
		h = n // 100
	else:
		h = n // 100 + 1
	if n % 4 == 0:
		f = n // 4
	else:
		f = n // 4 + 1
	if n > 100 and n % 100 != 0:
		p = n // 100
		if n % 100 % 4 == 0:
			r = n % 100 // 4
		else:
			r = n % 100 // 4 + 1
	print(min(h * b, f * c, p * b + r * c))
	t -= 1


from math import ceil
t = int(input())
for i in range(0, t):
	(n, x, y) = map(int, input().split())
	pol = 0
	while n:
		if n >= 100:
			if x <= y * 25:
				n -= 100
				pol += x
			else:
				n -= 100
				pol += 25 * y
		elif x <= y * ceil(n / 4):
			n = 0
			pol += x
		else:
			pol += y * ceil(n / 4)
			n = 0
	print(pol)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	bus = math.ceil(n / 100) * x
	car = math.ceil(n / 4) * y
	car_bus = n // 4 * y + math.ceil((n - 4 * (n // 4)) / 100) * x
	bus_car = n // 100 * x + math.ceil((n - 100 * (n // 100)) / 4) * y
	print(min(bus, car, car_bus, bus_car))


def answer():
	(n, x, y) = map(int, input().split())
	bus = n // 100
	car = bus * 25
	bs = bus * x
	cs = car * y
	n = n % 100
	s = min(bs, cs)
	if n > 0:
		bs = x
		cc = (n + 4 - 1) // 4
		cs = cc * y
		s = s + min(bs, cs)
	print(s)
for test in range(int(input())):
	answer()


import math
for t in range(int(input())):
	(n, x, y) = map(int, input().split())
	l = 0
	n1 = n
	while n1 > 0:
		n1 -= 100
		l += 1
	i = n // 100
	j = math.ceil((n - i * 100) / 4)
	k = math.ceil(n / 4)
	print(min(i * x + j * y, k * y, l * x))


t = input()
for c in range(0, int(t)):
	(n, x, y) = map(int, input().split())
	a = b = c = 0
	n1 = n2 = n3 = n
	while n1 > 0:
		n1 = n1 - 100
		a += 1
	while n2 > 0:
		n2 = n2 - 4
		b += 1
	while n3 > 0:
		if n3 >= 100:
			n3 = n3 - 100
			c = c + x
		else:
			n3 = n3 - 4
			c = c + y
	print(min(a * x, b * y, c))


import math
t = int(input())
for _ in range(t):
	emmit = 0
	(n, x, y) = map(int, input().split())
	rem = n % 100
	if x <= y:
		print(x * math.ceil(n / 100))
	elif x > y and x <= 25 * y:
		c = y * math.ceil(rem / 4)
		print(x * (n // 100) + min(c, x))
	else:
		print(y * math.ceil(n / 4))


from math import ceil
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	ansb = ceil(n / 100) * x
	ansc = ceil(n / 4) * y
	carryc = ceil(n % 100 / 4) * y
	carryd = ceil(n % 4 / 100) * x
	ans = min(ansb, ansc, n // 100 * x + carryc, carryd + n // 4 * y)
	print(ans)


import math
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	r = n % 100
	if x <= y:
		print(math.ceil(n / 100) * x)
	elif x > y and x <= 25 * y:
		c = math.ceil(r / 4) * y
		print(n // 100 * x + min(x, c))
	else:
		print(math.ceil(n / 4) * y)


n = int(input())
for i in range(n):
	(N, X, Y) = map(int, input().split(' '))
	if N % 4 == 0:
		t = 0
	else:
		t = 1
	min = Y * (N // 4 + t)
	for j in range(1, N // 100 + 2):
		if j != N // 100 + 1:
			pol = j * X + Y * ((N - j * 100) // 4 + t)
		else:
			pol = j * X
		if pol <= min:
			min = pol
	print(min)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	pollution = 0
	while n > 100:
		pollution += min(x, y * 25)
		n -= 100
	if n > 0:
		k = math.ceil(n / 4)
		pollution += min(k * y, x)
	print(pollution)


from math import ceil
t = int(input())
for i in range(t):
	(n, x, y) = (int(x) for x in input().split())
	m = 0
	while n > 100:
		m += min(x, y * 25)
		n -= 100
	if n > 0:
		c = ceil(n / 4)
		m += min(x, c * y)
	print(m)


import math

def solve(n, x, y):
	smoke = 0
	while n >= 100:
		smoke += min(x, y * 25)
		n -= 100
	if n > 0:
		c = math.ceil(n / 4)
		smoke += min(x, y * c)
	return smoke
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	print(solve(n, x, y))


for t in range(int(input())):
	(n, x, y) = list(map(int, input().split()))
	if x <= y:
		if n % 100 == 0:
			r = x * (n // 100)
		else:
			r = x * (n // 100 + 1)
		print(r)
	elif y * 25 <= x:
		if n % 4 == 0:
			r = y * (n // 4)
		else:
			r = y * (n // 4 + 1)
		print(r)
	else:
		r = n // 100 * x
		n %= 100
		if n % 4 == 0:
			y = n // 4 * y
		else:
			y = (n // 4 + 1) * y
		if x < y:
			print(x + r)
		else:
			print(y + r)


from math import ceil
for t in range(int(input())):
	(n, x, y) = map(int, input().split())
	fin = 0
	if x / n <= y / n * 25:
		fin += n // 100 * x
		remain = n - n // 100 * 100
		if ceil(remain / 4) * y < ceil(remain / 100) * x:
			fin += ceil(remain / 4) * y
		else:
			fin += ceil(remain / 100) * x
	else:
		fin += ceil(n / 4) * y
	print(fin)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	car = math.ceil(n / 4) * y
	bus = math.ceil(n / 100) * x
	busCar = math.inf
	if n > 100:
		B = math.floor(n / 100) * x
		C = math.ceil((n - math.floor(n / 100) * 100) / 4) * y
		busCar = B + C
	print(min(car, bus, busCar))


for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	Ans = 0
	for_hundred = min(x, 25 * y)
	Ans += for_hundred * (n // 100)
	rem = n % 100
	Y = rem // 4
	if rem % 4 != 0:
		Y += 1
	Ans += min(Y * y, x)
	print(Ans)


import math
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	bus = 0
	car = 0
	while n > 0:
		if n < 100:
			if x <= math.ceil(n / 4) * y:
				bus += 1
				n = 0
			else:
				car += math.ceil(n / 4)
				n = 0
		elif n >= 100:
			if x <= 25 * y:
				bus += 1
				n = n - 100
			else:
				car += 25
				n = n - 100
	print(car * y + bus * x)


tst = int(input())
for i in range(tst):
	(n, x, y) = map(int, input().split())
	a1 = 0
	b1 = 0
	c1 = 0
	val = 0
	d1 = 0
	if n % 4 == 0:
		a1 = int(n / 4) * y
	else:
		a1 = int(n / 4) * y + y
	if n % 100 == 0:
		b1 = int(n / 100) * x
	else:
		b1 = int(n / 100) * x + x
	c1 = int(n / 100)
	d1 = n - c1 * 100
	if d1 % 4 == 0:
		val = int(d1 / 4) * y
	else:
		val = int(d1 / 4) * y + y
	val = val + c1 * x
	ans = min(a1, b1, val)
	print(ans)


for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	polu = 0
	while n >= 100:
		polu += min(x, y * 25)
		n -= 100
	if n:
		cars = -(n // -4)
		polu += min(x, cars * y)
	print(polu)


import math
tests = int(input())
for i in range(tests):
	(n, x, y) = map(int, input().split())
	if y * 25 <= x:
		print(math.ceil(n / 4) * y)
	else:
		initial_buses = n // 100
		remaining = n % 100
		cars_requried = math.ceil(remaining / 4)
		remaining_smoke = min(cars_requried * y, x)
		print(initial_buses * x + remaining_smoke)


import math
for _ in range(int(input())):
	(people, bus, car) = map(int, input().split())
	eff = min(bus, math.ceil(people / 4) * car)
	if 25 * car <= bus:
		print(math.ceil(people / 4) * car)
	elif car >= bus:
		print(math.ceil(people / 100) * bus)
	elif people < 100:
		print(min(bus, math.ceil(people / 4) * car))
	else:
		print(min(bus * (people // 100) + math.ceil(people % 100 / 4) * car, bus * (people // 100) + bus))


import math
t = int(input())
for _ in range(t):
	arr = list(map(int, input().split()))
	n = arr[0]
	x = arr[1]
	y = arr[2]
	if n <= 100:
		busSmoke = x
		carSmoke = y * math.ceil(n / 4)
		print(min(busSmoke, carSmoke))
	else:
		busOnlySmoke = x * math.ceil(n / 100)
		carOnlySmoke = y * math.ceil(n / 4)
		busNCarComboSmoke = x * (n // 100)
		n = n % 100
		busNCarComboSmoke += y * math.ceil(n / 4)
		minVal = min(busOnlySmoke, carOnlySmoke)
		minVal = min(minVal, busNCarComboSmoke)
		print(minVal)


from math import ceil
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	rem = n % 100
	remc = n % 4
	bus = (n // 100 + (1 if rem != 0 else 0)) * x
	car = (n // 4 + (1 if remc != 0 else 0)) * y
	print(min(bus, car, n // 100 * x + (rem // 4 + (0 if rem % 4 == 0 else 1)) * y))


t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	s1 = n // 100 * x
	if n % 100 != 0:
		s1 += x
	s2 = n // 4 * y
	if n % 4 != 0:
		s2 += y
	s3 = n // 100 * x + n % 100 // 4 * y
	if n % 4 != 0:
		s3 += y
	print(min(s1, s2, s3))


import math
for i in range(int(input())):
	(n, x, y) = map(int, input().split())
	b = x * math.ceil(n / 100)
	c = y * math.ceil(n / 4)
	d = x * (n // 100) + y * math.ceil(n % 100 / 4)
	e = y * (n // 4) + x * math.ceil(n % 4 / 100)
	print(min(b, c, d, e))


import math
for hm in range(int(input().strip())):
	a = list(map(int, input().strip().split(' ')))
	bus = 0
	cars = 0
	if a[1] < a[2] * 25:
		bus += a[0] // 100
		a[0] = a[0] % 100
		if math.ceil(a[0] / 4) * a[2] > a[1]:
			bus += 1
		else:
			cars += math.ceil(a[0] / 4)
	else:
		cars += math.ceil(a[0] / 4)
	print(cars * a[2] + bus * a[1])


from math import ceil
t = int(input())
for j in range(t):
	(n, x, y) = map(int, input().split())
	p = 0
	while n >= 100:
		a = y * 25
		b = x
		p += min(a, b)
		n = n - 100
	if n > 0:
		a = y * ceil(n / 4)
		b = x
		p += min(a, b)
	print(p)


from math import ceil
for _ in range(int(input())):
	(N, X, Y) = [int(s) for s in input().split()]
	if X >= 25 * Y:
		print(Y * ceil(N / 4))
	else:
		print(X * (N // 100) + min(X, Y * ceil(N % 100 / 4)))


t = int(input())
for i in range(t):
	(n, x, y) = map(int, input().split())
	if x > 25 * y:
		if n % 4 != 0:
			print((n // 4 + 1) * y)
		if n % 4 == 0:
			print(n // 4 * y)
	else:
		b = 0
		c = 0
		b = n // 100
		n = n % 100
		if n % 4 == 0:
			c = n // 4
		else:
			c = n // 4 + 1
		if n % 4 == 0:
			c = n // 4
		if n % 4 != 0:
			c = n // 4 + 1
		if c * y >= x:
			b += 1
			c = 0
		print(b * x + c * y)


import sys
import math
import bisect
import numpy as np
from sys import stdin, stdout
from itertools import accumulate, chain, combinations, groupby, permutations, product
from collections import deque, Counter
from bisect import bisect_left, bisect_right
from math import gcd, sqrt, sin, cos, tan, degrees, radians
from fractions import Fraction
from decimal import Decimal
import sys
MOD = 10 ** 9 + 7
INF = 10 ** 20
sys.setrecursionlimit(100000000)
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))

def solve():
	(n, x, y) = map(int, input().split())
	a = ceil(n / 100) * x
	b = ceil(n / 4) * y
	c = ceil(n % 100 / 4) * y
	d = ceil(n % 4 / 100) * x
	print(min(a, b, n // 100 * x + c, n // 4 * y + d))
for _ in range(int(input())):
	solve()


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	if y >= x:
		ans = math.ceil(n / 100)
		ans = ans * x
	elif x >= 25 * y:
		ans = math.ceil(n / 4)
		ans = ans * y
	else:
		k = math.floor(n / 100)
		ans = k * x
		if math.ceil((n - k * 100) / 4) * y > x:
			ans += x
		else:
			ans += math.ceil((n - k * 100) / 4) * y
	print(ans)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	bus = n // 100
	car = bus * 25
	bus_pol = bus * x
	car_pol = car * y
	result = min(bus_pol, car_pol)
	n = n % 100
	if n > 0:
		bus_pol = x
		car_pol = math.ceil(n / 4) * y
		result += min(bus_pol, car_pol)
	print(result)


import math
for _ in range(int(input())):
	(n, x, y) = map(int, input().split())
	total_smoke = 0
	bus = n // 100
	car = bus * 25
	bus_smoke = bus * x
	car_smoke = car * y
	total_smoke = min(bus_smoke, car_smoke)
	n = n % 100
	if n > 0:
		bus_smoke = x
		car = math.ceil(n / 4)
		car_smoke = car * y
		total_smoke += min(bus_smoke, car_smoke)
	print(total_smoke)


from math import ceil
t = int(input())
while t > 0:
	t -= 1
	(n, x, y) = map(int, input().split())
	hun = n // 100
	a = hun * min(x, 25 * y)
	b = min(x, ceil(n % 100 / 4) * y)
	print(a + b)


import math
t = int(input())
for i in range(t):
	(n, x, y) = list(map(int, input().split()))
	rc = math.ceil(n / 4)
	rb = math.ceil(n / 100)
	sm = 0
	while n > 0:
		if n >= 100:
			n -= 100
			sm += x
		elif n >= 4:
			n -= 4
			sm += y
		else:
			break
	if n > 0:
		sm += y
	print(min(rc * y, rb * x, sm))


import math
T = int(input())
for _ in range(T):
	(N, X, Y) = map(int, input().split())
	smoke = 0
	while N >= 100:
		bus_smoke = X
		car_smoke = 25 * Y
		smoke += min(bus_smoke, car_smoke)
		N -= 100
	if N > 0:
		cars = math.ceil(N / 4.0)
		car_smoke = cars * Y
		bus_smoke = X
		smoke += min(bus_smoke, car_smoke)
	print(smoke)


t = int(input())
for i in range(t):
	(n, x, y) = [int(i) for i in input().split()]
	a = n // 100
	if n % 100 != 0:
		a = a + 1
	arr = [0] * (a + 1)
	i = 0
	while a >= 0:
		g = n - a * 100
		if g > 0:
			b = g // 4
			if g % 4 != 0:
				b = b + 1
		else:
			b = 0
		arr[i] = a * x + b * y
		a = a - 1
		i = i + 1
	arr.sort()
	print(arr[0])


import math
for i in range(int(input())):
	(n, x, y) = [int(i) for i in input().split()]
	m = x / y
	if m <= 1:
		print(math.ceil(n / 100) * x)
	elif m >= 25:
		print(math.ceil(n / 4) * y)
	else:
		n2 = n % 100
		if math.ceil(n2 / 4) >= m:
			print(math.ceil(n / 100) * x)
		else:
			print(n // 100 * x + math.ceil(n2 / 4) * y)


import math as m
for _ in range(int(input())):
	(n, x, y) = (int(i) for i in input().split())
	ans = 10 ** 9
	i = 0
	while i <= n:
		ans = min(x * m.ceil(i / 100) + y * m.ceil((n - i) / 4), ans)
		i += 1
	print(ans)


z = int(input())
for i in range(z):
	(n, y, x) = map(int, input().split())
	if n <= 100:
		k = x * (n // 4)
		if float(n // 4) != n / 4:
			k += x
		if k > y:
			print(y)
		else:
			print(k)
	else:
		m = n % 100
		k = x * (m // 4)
		if float(m // 4) != m / 4:
			k += x
		j = n // 100 * y
		l = k + j
		p = y * (n // 100)
		if float(n // 100) != n / 100:
			p += y
		if l > p:
			print(p)
		else:
			k1 = x * (n // 4)
			if float(n // 4) != n / 4:
				k1 += x
			j1 = y * (n // 100)
			if float(n // 100) != n / 100:
				j1 += y
			o = [k1, j1, l]
			print(min(o))


import sys, math, string, random, array, numpy as np

def solve():
	(n, x, y) = map(int, input().split())
	m = (n + 99) // 100 * x
	m = min(m, (n + 3) // 4 * y)
	m = min(m, n // 100 * x + (n % 100 + 3) // 4 * y)
	print(m)
t = int(input())
for i in range(t):
	solve()


import sys
input = sys.stdin.readline

def rii():
	return range(int(input().strip()))

def ii():
	return int(input().strip())

def mii():
	return map(int, input().strip().split(' '))

def lmii():
	return list(map(int, input().strip().split(' ')))

def si():
	return str(input().strip())
from math import ceil
infinity = 1000 * 1000 * 1000
bus_capacity = 100
car_capacity = 4

def solve(*args):
	(n, x, y) = args
	best = infinity
	for buses in range(ceil(n / bus_capacity) + 1):
		emitted = buses * x + ceil(max(0, n - buses * bus_capacity) / car_capacity) * y
		best = min(emitted, best)
	return best

def do_codechef():
	for t in rii():
		(n, x, y) = mii()
		print(solve(n, x, y))
do_codechef()
exit()