Your company was appointed to lay new asphalt on the highway of length $n$. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing.

Skipping the repair is necessary because of the climate. The climate in your region is periodical: there are $g$ days when the weather is good and if you lay new asphalt these days it becomes high-quality pavement; after that, the weather during the next $b$ days is bad, and if you lay new asphalt these days it becomes low-quality pavement; again $g$ good days, $b$ bad days and so on.

You can be sure that you start repairing at the start of a good season, in other words, days $1, 2, \dots, g$ are good.

You don't really care about the quality of the highway, you just want to make sure that at least half of the highway will have high-quality pavement. For example, if the $n = 5$ then at least $3$ units of the highway should have high quality; if $n = 4$ then at least $2$ units should have high quality.

What is the minimum number of days is needed to finish the repair of the whole highway?


-----Input-----

The first line contains a single integer $T$ ($1 \le T \le 10^4$) — the number of test cases.

Next $T$ lines contain test cases — one per line. Each line contains three integers $n$, $g$ and $b$ ($1 \le n, g, b \le 10^9$) — the length of the highway and the number of good and bad days respectively.


-----Output-----

Print $T$ integers — one per test case. For each test case, print the minimum number of days required to repair the whole highway if at least half of it should have high quality.


-----Example-----
Input
3
5 1 1
8 10 10
1000000 1 1000000

Output
5
8
499999500000



-----Note-----

In the first test case, you can just lay new asphalt each day, since days $1, 3, 5$ are good.

In the second test case, you can also lay new asphalt each day, since days $1$-$8$ are good.

Difficulty: MEDIUM

Solutions:
def inp(dtype=str, strip=True):
	s = input()
	res = [dtype(p) for p in s.split()]
	res = res[0] if len(res) == 1 and strip else res
	return res

def problemA():
	t = int(input())
	for _ in range(t):
		s = input()
		res = 0
		for i in range(s.find('1'), s.rfind('1')):
			res += int(s[i] == '0')
		print(res)

def problemB():
	t = int(input())
	for _ in range(t):
		(n, g, b) = inp(int)
		hq = (n + 1) // 2
		hq_days = (hq - 1) // g * (g + b) + (hq - 1) % g + 1
		res = max(n, hq_days)
		print(res)
problemB()


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
		continue
	loop = n // (2 * g)
	if n % (2 * g) == 0:
		loop -= 1
	rest = n - 2 * g * loop
	print(loop * (b + g) + (rest + 1) // 2 + max(rest // 2 - loop * (b - g), 0))


import math

def posibility(x, n, g, b):
	half = math.ceil(n / 2)
	combine = g + b
	cycles = x // combine
	extra = x % combine
	extraGood = 0
	extraBad = 0
	if extra > 0:
		extraGood = min(g, extra)
		extra -= extraGood
	if extra > 0:
		extraBad = min(b, extra)
		extra -= extraBad
	totalGood = cycles * g + extraGood
	totalBad = cycles * b + extraBad
	if totalGood < half or totalGood + totalBad < n:
		return False
	return True
testCases = int(input())
for _ in range(testCases):
	(n, g, b) = [int(x) for x in input().split()]
	start = 0
	end = 10 ** 18
	while end - start > 1:
		mid = (start + end) // 2
		if posibility(mid, n, g, b):
			end = mid
		else:
			start = mid
	print(end)


for T in range(int(input())):
	(n, g, b) = map(int, input().split())
	m = (n + 1) // 2
	print(max(n, m // g * (g + b) + (m % g if m % g else -b)))


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	counter = 0
	sounter = 0
	x = math.ceil(n / 2)
	y = math.ceil(x / g)
	if x // g == 0:
		sounter += x % g
		counter = n
	elif x % g == 0:
		sounter += x // g * g + (x // g - 1) * b
		counter += max(sounter, n)
	elif x // g != 0 and x % g != 0:
		sounter += x // g * g + x // g * b
		counter += max(n, sounter + x % g)
	print(counter)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	elif g >= b:
		print(n)
	else:
		if n % 2 == 0:
			gc = n // 2
		else:
			gc = n // 2 + 1
		if gc % g == 0:
			loops = gc // g - 1
			cost = g
		else:
			loops = gc // g
			cost = gc % g
		ans = loops * (g + b) + cost
		if loops * b < n - gc:
			ans += n - gc - loops * b
		print(ans)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for i in range(0, t):
	(n, g, b) = list(map(int, input().split()))
	if n % 2 == 0:
		w = n // 2
	else:
		w = n // 2 + 1
	s = math.ceil(w / g)
	ans1 = s * g
	if ans1 > w:
		ans1 = w
	days = ans1 + b * (s - 1)
	print(max(days, n))


import math
t = int(input())
for _ in range(t):
	(n, g, b) = [int(i) for i in input().split()]
	half = int(math.ceil(n / 2))
	need = int(math.floor(half / g))
	total = need * (g + b)
	if half % g != 0:
		total += half % g
	else:
		total -= b
	print(max(total, n))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	req = n // 2
	if n % 2 != 0:
		req += 1
	rem = n - req
	if g >= req:
		days = n
	elif g > b:
		days = n
	else:
		days = req
		extra = req // g
		if req % g != 0:
			extra += 1
		extra -= 1
		extra *= b
		if extra >= rem:
			days += extra
		else:
			days += rem
	print(days)


t = int(input())
for i in range(0, t):
	(n, g, b) = input().split()
	n = int(n)
	if n % 2 == 0:
		h = n // 2
	else:
		h = n // 2 + 1
	g = int(g)
	b = int(b)
	if g > h:
		print(n)
	elif h % g == 0:
		days = h + (h // g - 1) * b
		if days < n:
			print(n)
		else:
			print(int(days))
	else:
		days = h + h // g * b
		if days < n:
			print(n)
		else:
			print(int(days))


t = int(input())
while t:
	ans = 0
	inl = list(input().split())
	(n, g, b) = (int(inl[0]), int(inl[1]), int(inl[2]))
	bad = n // 2
	kday = bad // b
	if kday * (g + b) >= n:
		ans = n
	elif kday * (g + b) + g + bad % b >= n:
		ans = n
	else:
		ans = (kday + 1) * (g + b)
		need = n - bad - (kday + 1) * g
		ans += need // g * (g + b) + need % g
		if need % g == 0:
			ans -= b
	print(ans)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		good = (n + 1) // 2
		bad = n - good
		if bad <= b * (math.ceil(good / g) - 1):
			print(good + b * (math.ceil(good / g) - 1))
		else:
			print(n)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 0
	h = 0
	if a % 2 != 0:
		h = a // 2
		h += 1
	else:
		h = a // 2
	x = h // b
	if h % b == 0:
		ans = b * x
		if x > 0:
			ans += c * (x - 1)
	else:
		ans = b * x
		if x > 0:
			ans += c * x
		ans += h % b
	ans = max(a, ans)
	print(ans)


import math
test = int(input())
for t in range(test):
	(n, g, b) = list(map(int, input().split()))
	req = math.ceil(n / 2)
	muls = req // g
	if muls == req / g:
		days = muls * (g + b) - b
	else:
		days = muls * (g + b) + req % g
	print(max(days, n))


import math
nu = int(input())
for i in range(nu):
	(n, g, b) = map(int, input().split())
	s = math.ceil(n / 2)
	if s > g:
		if s % g == 0:
			print(max(g * (s // g) + b * (s // g - 1), n))
		else:
			print(max((g + b) * (s // g) + s % g, n))
	else:
		print(n)


t = int(input())

def check(n, h, g, b, m):
	if m < n:
		return False
	(loop, rest) = divmod(m, g + b)
	ok = min(rest, g) + loop * g
	return ok >= h
for _ in range(t):
	(n, g, b) = map(int, input().split())
	high = (n + 1) // 2
	(ok, ng) = (10 ** 20, 0)
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if check(n, high, g, b, mid):
			ok = mid
		else:
			ng = mid
	print(ok)


def updiv(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1
t = int(input())
for loop in range(t):
	(n, g, b) = map(int, input().split())
	able_bad = n // 2
	if n // (g + b) * b + max(0, n % (g + b) - g) <= able_bad:
		print(n)
		continue
	nday = updiv(able_bad, b) * (b + g)
	n -= updiv(able_bad, b) * g + able_bad
	nday += n + (updiv(n, g) - 1) * b
	print(nday)


from math import ceil
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g > n:
		g = n
	day = ceil(n / 2)
	useg = ceil(day / g)
	useb = useg - 1
	res = n
	if n - useb * b < day:
		res += day - (n - useb * b)
	print(res)


t = int(input())
ans_list = []
for i in range(t):
	(n, g, b) = map(int, input().split())
	need_way = (n + 1) // 2
	need_days = need_way // g * (g + b)
	if need_way % g == 0:
		need_days -= b
	else:
		need_days += need_way % g
	ans_list.append(max(n, need_days))
for g in range(t):
	print(ans_list[g])


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = a // 2
	s = 0
	if a % 2 == 1:
		d += 1
	e = a - d
	if b >= a:
		print(a)
		continue
	if b >= c:
		print(a)
		continue
	if b < c:
		if b >= d:
			print(a)
		else:
			f = d // b
			if d % b != 0:
				f += 1
			g = (f - 1) * c
			if d + g >= a:
				print(d + g)
			else:
				print(a)


def func(n, g, b):
	need_g = (n + 1) // 2
	total_g = need_g // g * (b + g)
	total_g += -b if need_g % g == 0 else need_g % g
	print(max(n, total_g))
for i in range(int(input())):
	(nn, gg, bb) = list(map(int, input().split()))
	func(nn, gg, bb)


def main():
	import sys
	input = sys.stdin.readline

	def num_of_days(n, g, b):
		p = n // (g + b)
		q = n % (g + b)
		gd = g * p + min(g, q)
		bd = n - gd
		return (gd, bd)
	T = int(input())
	for t in range(T):
		(n, g, b) = map(int, input().split())
		l = n
		r = 10 ** 20
		ans = -1
		while l <= r:
			mid = (l + r) // 2
			(gd, bd) = num_of_days(mid, g, b)
			if gd >= (n + 1) // 2 and mid >= n:
				ans = mid
				r = mid - 1
			else:
				l = mid + 1
		print(ans)
main()


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	toDo = n // 2 + n % 2
	if g >= toDo:
		print(n)
	else:
		total = b + g
		ans = g
		toDo -= g
		ans += toDo // g * total
		toDo %= g
		if toDo > 0:
			ans += b + toDo
		if ans < n:
			ans = n
		print(ans)


for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	k = (n + 1) // 2
	ans = (g + b) * (k // g)
	if k % g == 0:
		ans -= b
	else:
		ans += k % g
	print(max(n, ans))


import sys
input = sys.stdin.readline
N = int(input())

def check(x, k):
	t = x // (b + g) * g + min(g, x % (b + g))
	u = x // (b + g) * b + max(0, x % (b + g) - g)
	if t >= -(-k // 2):
		return t + u >= k
	return False
for _ in range(N):
	(k, g, b) = map(int, input().split())
	ok = (g + b) * k
	ng = 0
	while ok - ng > 1:
		m = (ok + ng) // 2
		if check(m, k):
			ok = m
		else:
			ng = m
	print(ok)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		gd = (n + 1) // 2
		bd = n - gd
		if gd <= g:
			print(n)
		else:
			ans = g
			gd -= g
			ans += gd // g * (g + b)
			if gd % g != 0:
				ans += gd % g + b
				bd -= b
			bd -= gd // g * b
			if bd > 0:
				ans += bd
			print(ans)


def go():
	(n, g, b) = map(int, input().split())
	if g >= b:
		return n
	half = (n + 1) // 2
	if g >= half:
		return n
	pers = half // g
	pers_left = half % g
	result = pers * g + (pers - 1) * b
	if pers_left:
		result += b + pers_left
	result = max(n, result)
	return result
t = int(input())
for _ in range(t):
	print(go())


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		(n, g, b) = map(int, input().split())
		bad_lim = n // 2
		d = bad_lim // b
		n0 = (g + b) * d + g + bad_lim % b
		if n0 >= n:
			print(n)
		else:
			ans = n0
			ans += b - bad_lim % b
			dd = (n - n0) // g
			ans += (g + b) * dd
			if (n - n0) % g:
				ans += (n - n0) % g
			else:
				ans -= b
			print(ans)
main()


import sys
input = sys.stdin.readline
t = int(input())

def judge(x, d, i, j):
	(p, q) = divmod(x, i + j)
	if d <= (p * i + min(q, i)) * 2 and d <= x:
		return True
	else:
		return False
for _ in range(t):
	(n, g, b) = map(int, input().split())
	l = 0
	r = 10 ** 18
	while l + 1 < r:
		m = (l + r) // 2
		if judge(m, n, g, b):
			r = m
		else:
			l = m
	print(r)


t = int(input())
a = []
p = 0
d = 0
for i in range(0, t):
	(l, g, b) = input().split()
	l = int(l)
	g = int(g)
	b = int(b)
	o = l
	m = 0
	if l % 2 == 0:
		l = l // 2
	else:
		l = l // 2 + 1
	if o <= g:
		d = o
	elif g < b:
		if l % g == 0:
			y = l // g
		else:
			y = l // g
			m = l % g
		d = y * g + m
		if m == 0:
			d = d + (y - 1) * b
		else:
			d = d + y * b
	else:
		d = o
	if d < o:
		d = o
	a.append(d)
	d = 0
	p = 0
for i in a:
	print(i)


def solution(test):
	(n, g, b) = [x for x in test]
	require = 0
	if n % 2 == 0:
		require = n // 2
	else:
		require = n // 2 + 1
	day = 0
	if require % g == 0:
		day = require + (require // g - 1) * b
	else:
		div = require // g
		day = div * (g + b) + require % g
	if day < n:
		day = n
	print(day)
test_case = int(input())
test_input = []
for i in range(test_case):
	ar = [int(x) for x in input().split()]
	test_input.append(ar)
for test in test_input:
	solution(test)


import math
t = int(input())
for test in range(t):
	[n, g, b] = [int(x) for x in input().split(' ')]
	d = math.ceil(n / 2)
	res = d
	q = d // g
	r = d % g
	if r != 0:
		res += b * q
	elif b >= g:
		res += b * (q - 1)
	else:
		res = n
	print(max(res, n))


import math
for _ in range(int(input())):
	(d, g, b) = map(int, input().split())
	x = (d + 1) // 2
	bd = math.ceil(x / g)
	total = x + b * (bd - 1)
	print(d if total <= d else total)


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	s = math.ceil(n / 2)
	x = s // g * (g + b)
	if s % g == 0:
		print(max(n, x - b))
	elif s % g != 0:
		x += s % g
		print(max(n, x))


import math
for i in range(int(input())):
	(t, g, b) = map(int, input().split())
	a = math.ceil(t / 2)
	c = math.ceil(a / g)
	result = b * (c - 1) + a
	if result < t:
		print(t)
	else:
		print(result)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		m = n
		n += 1
		n //= 2
		if n <= g:
			print(m)
		else:
			ans = (n - 1) // g * (g + b)
			if n % g > 0:
				ans += n % g
			else:
				ans += g
			print(max(m, ans))


import sys
import math

def can(days, g, b, n):
	good = (n + 1) // 2
	x = days // (g + b)
	y = days % (g + b)
	bad = n - good
	gd = x * g
	if y >= g:
		gd += g
	else:
		gd += y
	bd = x * b
	if y > g:
		bd += y - g
	if gd >= good and gd + bd >= n:
		return True
	return False
t = int(sys.stdin.readline())
for _ in range(t):
	(n, g, b) = map(int, sys.stdin.readline().split())
	right = 10000000000000000000000
	left = 1
	ans = float('inf')
	while left <= right:
		mid = (left + right) // 2
		if can(mid, g, b, n):
			right = mid - 1
			ans = min(ans, mid)
		else:
			left = mid + 1
	print(ans)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	hf = (n - 1) // 2 + 1
	if hf // g == 0:
		res = n
	elif hf % g == 0:
		res = max(b * (hf // g - 1) + hf, n)
	else:
		res = max(b * (hf // g) + hf, n)
	print(res)


import math
t = int(input())
for i in range(t):
	(n, g, b) = input().split(' ')
	n = int(n)
	g = int(g)
	b = int(b)
	k = int((n + 1) / 2)
	ans = int(k + (math.ceil(k * 1.0 / g) - 1) * b)
	if ans < n:
		ans = n
	print(ans)


for tc in range(int(input())):
	(n, g, b) = map(int, input().split())
	temp = (n + 1) // 2
	x = temp // g * (g + b)
	x += temp % g
	if temp % g == 0:
		x -= b
	print(max(n, x))


T = int(input())
import math as mt
for i in range(T):
	(n, g, b) = list(map(int, input().split()))
	half = mt.ceil(n / 2)
	good = mt.ceil(half / g)
	day_till = good * g + (good - 1) * b
	diff = 0
	if good * g - half > 0:
		day_till = day_till - (good * g - half)
	if day_till < n:
		diff = n - day_till
	print(day_till + diff)


for _ in range(int(input())):
	(n, g, b) = [int(i) for i in input().split()]
	need = (n + 1) // 2
	total = need // g * (g + b)
	rem = need % g
	if rem == 0:
		total -= b
	else:
		total += rem
	print(max(total, n))


import sys
import math
import bisect
import heapq
from bisect import bisect_right
from sys import stdin, stdout

def get_ints_in_variables():
	return map(int, sys.stdin.readline().strip().split())

def get_int():
	return int(sys.stdin.readline())

def get_ints_in_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

def get_string():
	return sys.stdin.readline().strip()

def myceil(x, y):
	return (x + y - 1) // y

def Solution():
	pass

def main():
	for _ in range(get_int()):
		(n, g, b) = get_ints_in_variables()
		ng = myceil(n, 2)
		totalDays = ng // g * (g + b) + ng % g
		if ng % g == 0:
			totalDays -= b
		print(max(n, totalDays))
main()


t = int(input())
for i in range(0, t):
	c = input().split(' ')
	n = int(c[0])
	g = int(c[1])
	b = int(c[2])
	d = n / 2
	dias = 0
	if n % 2 == 0:
		d = int(d)
	else:
		d = int(d) + 1
	dias = int(d / g) * (b + g)
	if d % g != 0:
		dias += d - g * int(d / g)
	else:
		dias -= b
	if dias < n:
		dias = n
	print(dias)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	orign = n
	n = (n + 1) // 2
	com = (n - 1) // g
	ans = com * (g + b)
	n -= com * g
	ans += n
	print(max(ans, orign))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b or n <= g:
		print(n)
	else:
		good = n % 2 + n // 2
		if good <= g:
			print(n)
			continue
		if good % g == 0:
			print(max(n, good // g * (b + g) - b))
		else:
			print(max(n, good // g * (b + g) + good % g))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	pol = (n + 1) // 2
	psme = (pol + g - 1) // g
	ans = psme * (g + b) - b - (psme * g - pol)
	print(max(ans, n))


import sys
input = sys.stdin.readline
from collections import deque
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	good = (a + 1) // 2
	cyc = (good + b - 1) // b
	ans = (cyc - 1) * (b + c) + min(good - (cyc - 1) * b, b)
	ans += max(a - ans, 0)
	print(ans)


def round(x):
	if not x % 2:
		return x // 2
	return x // 2 + 1
T = int(input())
for i in range(T):
	(n, g, b) = [int(j) for j in input().split()]
	n0 = n
	n = (n + 1) // 2
	good = (n - 1) // g
	print(max(good * b + n, n0))


import sys
import math
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, G, B) = [int(x) for x in input().split()]
		least = -(-N // 2)
		a = -(-least // G)
		if G >= N:
			print(N)
		else:
			x = (a - 1) * (G + B)
			if N - x > G:
				print(N)
			else:
				print(x + max(-(-N // 2) - (a - 1) * G, N - x))
main()


from math import *
t = int(input())
for zz in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		tn = n
		x = (n + 1) // 2
		te = x // g
		m = x % g
		if m == 0:
			te -= 1
			print(max(tn, te * (g + b) + g))
		else:
			n -= 2 * te * g
			print(max(te * (g + b) + (n + 1) // 2, tn))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	desired = (n + 1) // 2
	cycl = desired // g
	if desired % g == 0:
		print(max(n, (b + g) * cycl - b))
	else:
		print(max(n, (b + g) * cycl + desired % g))


for _ in range(int(input())):
	(n, g, b) = tuple(map(int, input().split()))
	req = 0
	if n % 2 == 0:
		req = n // 2
	else:
		req = (n + 1) // 2
	periods = (req + g - 1) // g
	bad_days = (periods - 1) * b
	if n - req <= bad_days:
		print(req + bad_days)
	else:
		print(n)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from functools import *
from itertools import permutations, combinations, groupby
import sys
import bisect
import string
import math
import time
import random

def Golf():
	(*a,) = map(int, open(0))

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def I():
	return int(input())

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	import random
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
ans = 0
t = I()
for _ in range(t):
	ans = 0
	(n, g, b) = LI()
	m = (n + 1) // 2
	d = m // g
	r = -b if m % g == 0 else m % g
	ans = max(n, d * (g + b) + r)
	print(ans)


import math
t = int(input())
while t:
	t = t - 1
	(n, g, b) = [int(s) for s in input().split()]
	good_days = math.ceil(n / 2)
	no_matter_days = n - good_days
	good_set = int(good_days / g)
	remaining_good_days = int(good_days % g)
	if remaining_good_days == 0:
		bad_set = good_set - 1
		required_days = good_set * g + bad_set * b
		bad_days = bad_set * b
		if bad_days >= no_matter_days:
			ans = required_days
		else:
			remaining_bed_days = no_matter_days - bad_days
			ans = required_days + remaining_bed_days
	else:
		bad_set = good_set
		required_days = good_set * g + bad_set * b
		bad_days = bad_set * b
		if bad_days >= no_matter_days:
			ans = required_days + remaining_good_days
		else:
			remaining_bed_days = no_matter_days - bad_days
			ans = required_days + remaining_bed_days + remaining_good_days
	print(ans)


for _ in range(int(input())):
	(todo, good, bad) = [int(x) for x in input().split()]
	needed = (todo + 1) // 2
	opers = (needed - 1) // good
	days = needed + opers * bad
	print(max(todo, days))


import math
t = int(input())
for _ in range(t):
	(n, good, bad) = map(int, input().split())
	half = n // 2 if n % 2 == 0 else n // 2 + 1
	num1 = math.ceil(half / good)
	num2 = math.ceil((n - half) / bad)
	(quo1, rem1) = divmod(half, good)
	(quo2, rem2) = divmod(n - half, bad)
	if num1 > num2:
		print(half + bad * (num1 - 1))
	else:
		(val, x) = divmod(n, good + bad)
		print(val * (good + bad) + x)


import sys
t = int(sys.stdin.readline().rstrip())

def main():
	for _ in range(t):
		(n, g, b) = map(int, sys.stdin.readline().split())
		half = (n + 1) // 2
		(q, r) = divmod(half, g)
		res = (g + b) * q + r if r else (g + b) * (q - 1) + g
		yield max(res, n)
ans = main()
print(*ans, sep='\n')


import math

def national(days):
	days = days.split()
	days = [int(days[i]) for i in range(len(days))]
	required_good = math.ceil(days[0] / 2)
	if days[1] >= required_good:
		return days[0]
	else:
		reach_good = math.ceil(required_good / days[1])
		bad_dept = days[2] * (reach_good - 1)
		prod_good = reach_good * days[1]
		days_needed_good = bad_dept + prod_good - (prod_good - required_good)
		if days_needed_good < days[0]:
			return days_needed_good + (days[0] - days_needed_good)
		else:
			return days_needed_good

def main():
	test = eval(input())
	for i in range(test):
		s = input()
		print(national(s))
main()


import math
I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(n, g, b) = I()
	if g >= b:
		print(n)
	else:
		required = math.ceil(n / 2)
		total = required // g * (g + b)
		if required % g == 0:
			total -= b
		else:
			total += required % g
		print(max(n, total))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	p = 0
	if n % 2 == 0:
		t = n // 2
	else:
		t = n // 2 + 1
	if t <= g:
		print(n)
	elif t % g == 0:
		r = t // g
		s = t + (r - 1) * b
		if s <= n:
			print(n)
		else:
			print(s)
	else:
		r = t // g
		s = t + r * b
		if s <= n:
			print(n)
		else:
			print(s)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().strip().split(' '))
	if g >= b or n <= g:
		print(n)
	else:
		k = (n + 1) // 2
		m = math.ceil(k / g)
		print(max(n, m * b - b + k))


def solve():
	(n, g, b) = map(int, input().split())
	target = (n + 1) // 2
	rounds = (target - 1) // g
	days = target + rounds * b
	print(max(n, days))
T = int(input())
for _ in range(T):
	solve()


import math
cases = int(input())
for t in range(cases):
	(n, g, b) = list(map(int, input().split()))
	k = math.ceil(n / 2)
	gd = k // g
	gr = k % g
	left = n - k
	if gr:
		nb = gd
	else:
		nb = max(0, gd - 1)
	f = 0
	if nb * b >= left:
		f = 1
	if f == 1:
		output = nb * b + gd * g + gr
	else:
		left -= nb * b
		if left <= g - gr:
			output = nb * b + gd * g + gr + left
		else:
			output = nb * b + (gd + 1) * g
			left -= g - gr
			vd = left // (g + b)
			vr = left % (g + b)
			output += vd * (g + b) + vr
	print(output)


def main_function():
	from math import ceil
	t = int(input())
	for i in range(t):
		(n, good, bad) = list(map(int, input().split(' ')))
		if n <= good:
			print(n)
			continue
		min_n = n // 2 + n % 2
		counter = ceil(min_n / good)
		total_days = (counter - 1) * bad + min_n // good * good + min_n % good
		if total_days >= n:
			print(total_days)
		else:
			print(total_days + n - min_n - (counter - 1) * bad)
main_function()


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	c = n // 2
	a = n - c
	q = a // g
	r = a % g
	if r == 0:
		x = q * g + (q - 1) * b
		if x < n:
			print(n)
		else:
			print(x)
	else:
		x = q * (g + b) + r
		if x < n:
			print(n)
		else:
			print(x)


import math
from decimal import *
import random
from datetime import datetime
import time
for _ in range(int(input())):
	(rn, g, b) = map(int, input().split())
	ans = 0
	n = int(math.ceil(rn / 2))
	left = 0
	right = int(10000000000.0)
	while left < right:
		mid = (left + right) // 2
		if g * mid >= n:
			right = mid
		else:
			left = mid + 1
	val = int(left - 1)
	ans = (g + b) * val
	ans += n - g * val
	low = rn - n - val * b
	if low > 0:
		ans += low
	print(ans)


import math
for t in range(int(input())):
	(n, g, b) = map(int, input().split())
	tar = (n + 1) // 2
	val = tar // g
	val2 = val * (g + b)
	if tar % g != 0:
		val2 += tar % g
	if tar % g == 0:
		val2 -= b
	print(max(val2, n))


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	av = math.ceil(n / 2)
	x = math.ceil(av / g)
	ans = (g + b) * x - b
	if av % g != 0:
		ans -= g - av % g
	if ans < n:
		ans = n
	print(ans)


for t in range(int(input())):
	(n, g, b) = map(int, input().split())
	i = int((n + 1) / 2)
	x = i % g + (g + b) * (i // g)
	if i % g == 0:
		x -= b
	print(max(n, x))


from math import ceil
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	t = ceil(a / 2)
	k = ceil(t / b)
	td = (k - 1) * (b + c) + (t - (k - 1) * b)
	rmd = a - td
	if rmd <= 0:
		print(td)
	else:
		print(td + rmd)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	goodNeeded = (n + 1) // 2
	totalG = goodNeeded // g * (b + g)
	if goodNeeded % g == 0:
		totalG -= b
	else:
		totalG += goodNeeded % g
	ans = max(totalG, n)
	print(ans)


for i in range(int(input())):
	a = list(map(int, input().split()))
	nn = (a[0] + 1) // 2
	print(max(nn + (nn - 1) // a[1] * a[2], a[0]))


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time

def I():
	return int(input())

def MI():
	return map(int, input().split())

def S():
	return input()

def MS():
	return map(str, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def StoI():
	return [ord(i) - 97 for i in input()]

def ItoS(nn):
	return chr(nn + 97)

def input():
	return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = {False: 'No', True: 'Yes'}
MOD = 10 ** 9 + 7
inf = float('inf')
IINF = 10 ** 10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False

def solve(T):
	(n, g, b) = MI()
	atleast = (n + 1) // 2
	if g >= n:
		print(n)
		return
	terms = (n + b) / (g + b)
	c = g * int(terms)
	if c >= atleast:
		print(n)
	else:
		terms = atleast // g
		r = atleast % g
		padding = n - atleast
		if r != 0:
			skipping = terms * b - padding
			print(max(terms * g + r + padding + skipping, n))
		else:
			skipping = terms * b - padding - b
			print(max(terms * g + padding + skipping, n))

def main():
	T = I()
	for i in range(T):
		solve(T)
main()


R = lambda : list(map(int, input().split()))
for _ in [0] * R()[0]:
	(n, g, b) = R()
	least = -1 - -n // 2
	print(max(n, least + least // g * b + 1))


n = int(input())
import math
for i in range(n):
	(n, g, b) = map(int, input().strip().split())
	ac = math.ceil(n / 2)
	k = n - ac
	d = 0
	if g >= n:
		print(n)
		d = 1
	else:
		r = (ac - 1) // g
		ans = r * b + ac
		print(max(ans, n))


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
mod = 1000000007
for i in range(I()):
	(n, g, b) = li()
	k = n // 2 + n % 2
	if k <= g:
		print(n)
		continue
	k -= g
	ans = g
	p = k // g
	s = g + b
	ans += p * s
	if k % g != 0:
		ans += b + k % g
	print(max(n, ans))


def run():
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		ng = (n + 1) // 2
		k = ng // g
		mod = ng % g
		if mod > 0:
			print(max(k * (g + b) + mod, n))
		else:
			print(max(k * (g + b) - b, n))
T = input()
T = int(T)
for i in range(T):
	run()


res = []
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	ans = 0
	good_roads = (n + 1) // 2
	good_days = (good_roads + g - 1) // g
	roads_remaining = n // 2
	if (good_days - 1) * b < roads_remaining:
		ans = n
	else:
		ans = (good_days - 1) * (b + g)
		ans += good_roads - (good_days - 1) * g
	res.append(ans)
print(*res, sep='\n')


from math import ceil
t = int(input())
for _ in range(t):
	(n, g, b) = list(map(int, input().split(' ')))
	d = ceil(n / 2)
	if d <= g:
		print(n)
	else:
		total_good_days = ceil(d / g) * g
		bad_days = b * (ceil(d / g) - 1)
		total_days = total_good_days + bad_days
		extra_good_days = 0
		if total_good_days > d:
			extra_good_days = total_good_days - d
		if bad_days >= n - d:
			s = total_days - extra_good_days
		else:
			s = d + bad_days + (n - d - bad_days)
		print(s)


from sys import stdin, stdout
import math
q = int(stdin.readline())
for x in range(q):
	(n, g, b) = [int(x) for x in stdin.readline().split()]
	if g >= n:
		print(n)
		continue
	need = math.ceil(n / 2)
	need_seg = math.ceil(need / g) - 1
	total_day = need_seg * (g + b)
	left = need - need_seg * g
	total_day += left
	if n - total_day > 0:
		total_day += n - total_day
	print(total_day)


import math
t = int(input())
for _ in range(t):
	(a, g, b) = map(int, input().split())
	if a % 2 == 0:
		n = a // 2
	else:
		n = a // 2 + 1
	r = n / g
	if r <= 1:
		print(a)
	elif r < 2:
		if n + b > a:
			print(n + b)
		else:
			print(a)
	else:
		r = math.ceil(r)
		if n + (r - 1) * b > a:
			print(n + (r - 1) * b)
		else:
			print(a)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	half = math.ceil(n / 2)
	found = 0
	if min(n % (g + b), g) + n // (g + b) * g >= half:
		found = 1
	if g >= half or found == 1:
		print(n)
	else:
		cikl = half // g
		nehvat = half - (min(n % (g + b), g) + n // (g + b) * g)
		if half % g != 0:
			ans = half // g
			ans = ans * (g + b) + n - ans * g
			print(ans - n // 2)
		else:
			ans = half // g
			ans = (ans - 1) * (g + b) + n - (ans - 1) * g
			print(ans - n // 2)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	elif n // 2 % b == 0:
		if (n + 1) // 2 % g == 0:
			print((n + 1) // 2 // g * (g + b) - b)
		else:
			print((n + 1) // 2 // g * (g + b) + (n + 1) // 2 % g)
	elif (n + 1) // 2 % g == 0:
		if ((n + 1) // 2 // g - 1) * b < n // 2:
			print((n + 1) // 2 // g * (g + b) - b + n // 2 - ((n + 1) // 2 // g - 1) * b)
		else:
			print((n + 1) // 2 // g * (g + b) - b)
	elif (n + 1) // 2 // g * b < n // 2:
		print((n + 1) // 2 // g * (g + b) + (n + 1) // 2 % g + n // 2 - (n + 1) // 2 // g * b)
	else:
		print((n + 1) // 2 // g * (g + b) + (n + 1) // 2 % g)


import sys
import math
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	(n, g, b) = read()
	r = math.ceil(n / 2)
	ans = r
	ans += (math.ceil(r / g) - 1) * b
	if ans < n:
		ans += n - ans
	print(ans)


def solve(N, G, B):
	threshold = (N + 1) // 2
	(cycles, remainder) = divmod(threshold, G)
	if cycles == 0:
		return N
	if remainder == 0:
		remainder -= B
	return max(N, cycles * (G + B) + remainder)
(T,) = map(int, input().split())
for t in range(T):
	(N, G, B) = map(int, input().split())
	ans = solve(N, G, B)
	print(ans)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	(n, g, b) = value()
	k = ceil(n / 2)
	g_set = ceil(k / g)
	tot = (g_set - 1) * (g + b)
	rem_g = k - (g_set - 1) * g
	tot += rem_g
	if tot >= n:
		print(tot)
	else:
		print(tot + n - tot)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	ng = (n + 1) // 2
	nb = n - ng
	h_d = (ng + g - 1) // g
	l_d = (nb + b - 1) // b
	if h_d > l_d:
		print((ng - 1) // g * (g + b) + ng - (ng - 1) // g * g)
	else:
		print(n)


def solve(n, g, b):
	needG = (n + 1) // 2
	days = needG // g * (g + b)
	days += -b if needG % g == 0 else needG % g
	print(max(n, days))
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	solve(n, a, b)


t = int(input())
while t:
	(total, gd, bd) = [int(x) for x in input().split()]
	half = (total + 1) // 2
	bd = ((half + gd - 1) // gd - 1) * bd
	gd = half // gd * gd + half % gd
	n = gd + bd
	if n >= total:
		print(n)
	else:
		print(n + (total - n))
	t = t - 1


from math import ceil
t = int(input())
while t > 0:
	(d, g, b) = [int(i) for i in input().split()]
	ans = 0
	req = 0
	need = 0
	remi = 0
	bneed = 0
	temp = 0
	if d & 1 != 0:
		req = d // 2 + 1
	else:
		req = d // 2
	if d <= g:
		ans = d
	elif d > g:
		need = ceil(req / g)
		remi = need * g - req
		bneed = b * (need - 1)
		temp = bneed + g * need - remi
		if temp >= d:
			ans = temp
		else:
			ans = d
	print(ans)
	t -= 1


from math import *
t = int(input())
for i in range(t):
	l = list(map(int, input().strip().split()))
	n = l[0]
	g = l[1]
	b = l[2]
	cg = 0
	cb = 0
	d = 0
	c = floor(ceil(n / 2) / g)
	if c == ceil(n / 2) / g:
		c -= 1
	d = c * (g + b)
	d += ceil(n / 2) - c * g
	if d < n:
		d = n
	print(d)


from math import ceil
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	t = ceil(n / 2)
	ans = (a + b) * (t // a)
	if t % a != 0:
		ans += t % a
	else:
		ans -= b
	print(max(ans, n))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, g, b) = [int(item) for item in input().split()]
	required = (n + 1) // 2
	cycle = (required - 1) // g
	good_enough = cycle * (b + g) + required - cycle * g
	print(max(n, good_enough))


from math import *
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	a = ceil(n / 2)
	high = ceil(a / g)
	ans = (high - 1) * b + a
	print(max(n, ans))


import math
for __ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n % 2 == 0:
		x = n // 2
	else:
		x = n // 2 + 1
	r = math.ceil(x / g)
	r1 = math.floor(x / g)
	if g >= x:
		print(n)
	elif r1 * g != x:
		if r1 * (g + b) + x - r1 * g < n:
			print(n)
		else:
			print(r1 * (g + b) + x - r1 * g)
	elif r1 * (g + b) - b < n:
		print(n)
	else:
		print(r1 * (g + b) - b)


import math
t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().strip().split()))
	a = n // (g + b) * g + min(n % (g + b), g)
	c = math.ceil(n / 2)
	if a >= c:
		print(n)
	else:
		a = math.ceil(n / 2)
		c = a // g
		d = a % g
		if a % g == 0:
			print(c * g + (c - 1) * b)
		else:
			print(c * g + c * b + d)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	high = math.ceil(n / 2)
	low = n - high
	q = high // g
	r = high % g
	ans = q * (g + b)
	if r:
		ans += r
	else:
		ans -= b
	rem = ans - high
	if rem < low:
		ans += low - rem
	print(ans)


from sys import stdin as inp
from math import gcd, sqrt, floor, ceil, log2, log
for _ in range(int(inp.readline())):
	(n, g, b) = map(int, inp.readline().split())
	minn = ceil(n / 2)
	tot = minn // g * (g + b)
	if minn % g > 0:
		tot += minn % g
	else:
		tot -= b
	print(max(n, tot))


def f(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def g(n, a, b):
	if a >= b:
		return n
	else:
		x = f(n, 2)
		y = n - x
		minmtrips = f(x, a)
		if (minmtrips - 1) * b >= y:
			if x % a == 0:
				return (minmtrips - 1) * (a + b) + a
			else:
				return (minmtrips - 1) * (a + b) + x % a
		else:
			return n
t = int(input())
for i in range(t):
	array = list(map(int, input().rstrip().split()))
	n = array[0]
	a = array[1]
	b = array[2]
	print(g(n, a, b))


import sys
import math
from collections import defaultdict
from collections import deque
from itertools import combinations
from itertools import permutations
input = lambda : sys.stdin.readline().rstrip()
read = lambda : list(map(int, input().split()))
go = lambda : 1 / 0

def write(*args, sep='\n'):
	for i in args:
		sys.stdout.write('{}{}'.format(i, sep))
INF = float('inf')
MOD = int(1000000000.0 + 7)
YES = 'YES'
NO = 'NO'
for _ in range(int(input())):
	try:
		(n, g, b) = read()
		total = math.ceil(n / 2)
		s = 0
		e = 1 << 63
		while s <= e:
			m = (s + e) // 2
			good = 0
			bad = 0
			x = m // (g + b)
			good += x * g
			bad += x * b
			y = m - m // (g + b) * (g + b)
			good += min(y, g)
			bad += max(0, y - g)
			if good + bad >= n and good >= total:
				e = m - 1
			else:
				s = m + 1
		print(s)
	except ZeroDivisionError:
		continue
	except Exception as e:
		print(e)
		continue


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split(' '))
	p = n // 2 + n % 2
	if p % g == 0:
		z = p // g * (g + b) - b
	else:
		z = (g + b) * (p // g) + p % g
	print(max(n, z))


t = int(input())
for _ in range(t):
	(n, g, b) = [int(x) for x in input().split()]
	if g >= b:
		ans = n
	else:
		bMAX = n // 2
		cl = g + b
		cl2 = g * 2
		nC = n // cl2
		if n % cl2 == 0:
			ans = nC * cl
			ng = g * nC
			nb = b * nC
			ub = ng + nb - n
			ans -= min(ub, b)
		else:
			ans = nC * cl
			ng = g * nC
			nb = b * nC
			t = ng + min(nb, bMAX)
			ans += n - t
	print(ans)


ans = []
for t in range(int(input())):
	[n, g, b] = [int(i) for i in input().split()]
	good = n // 2 + n % 2
	bad = n - good
	k = good // g + (good % g != 0)
	if k == 0:
		a = n
	else:
		a = (k - 1) * (g + b) + good % g
		if good % g == 0:
			a += g
		temp = max(0, n - a)
		a += temp
	ans.append(str(a))
print('\n'.join(ans))


t = int(input())
for i in range(t):
	l = list(input().split(' '))
	l[0] = int(l[0])
	l[1] = int(l[1])
	l[2] = int(l[2])
	if l[1] >= (l[0] + 1) // 2:
		print(l[0])
	else:
		z = (l[0] + 1) // 2
		g = l[1]
		b = l[2]
		x = z // g
		if z % g == 0:
			y = x * g + (x - 1) * b
		else:
			y = x * (b + g) + z % g
		print(max(l[0], y))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if n % 2 == 0:
		req = n // 2
	else:
		req = n // 2 + 1
	q = req // g
	rem = req % g
	if rem == 0:
		bcov = b * (q - 1)
	else:
		bcov = b * q
	tot = bcov + q * g + rem
	if tot >= n:
		print(tot)
	else:
		print(n)


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import math
cases = int(input())
for t in range(cases):
	(n, g, b) = list(map(int, input().split()))
	k = math.ceil(n / 2)
	gd = k // g
	gr = k % g
	left = n - k
	if gr:
		nb = gd
	else:
		nb = max(0, gd - 1)
	f = 0
	if nb * b >= left:
		f = 1
	if f == 1:
		output = nb * b + gd * g + gr
	else:
		left -= nb * b
		if left <= g - gr:
			output = nb * b + gd * g + gr + left
		else:
			output = nb * b + (gd + 1) * g
			left -= g - gr
			vd = left // (g + b)
			vr = left % (g + b)
			output += vd * (g + b) + vr
	print(output)


import sys, os
from io import BytesIO, IOBase
import math
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from itertools import permutations
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return Fals
	return True
for _ in range(int(inp())):
	(n, a, b) = mp()
	if a >= b:
		print(n)
		continue
	x = (n + 1) // 2
	if x % a == 0:
		print(max(n, (x // a - 1) * (a + b) + a))
	else:
		print(max(n, x // a * (a + b) + x % a))


import math
t = int(input())
for i in range(t):
	(n, g, b) = input().split()
	n = int(n)
	g = int(g)
	b = int(b)
	n1 = (n + 1) // 2
	g1 = n1 // g
	if n1 % g == 0:
		if n < g1 * g + (g1 - 1) * b:
			print(g1 * g + (g1 - 1) * b)
		else:
			print(n)
	elif n < g1 * g + g1 * b + n1 % g:
		print(g1 * g + g1 * b + n1 % g)
	else:
		print(n)


t = int(input())
n = []
g = []
b = []
for _ in range(t):
	[ni, gi, bi] = input().split()
	n.append(int(ni))
	g.append(int(gi))
	b.append(int(bi))
for i in range(len(n)):
	goodnum = (n[i] + 1) // 2
	goodtimes = goodnum // g[i]
	ret = goodtimes * g[i] + (goodtimes - 1) * b[i]
	if goodnum % g[i]:
		ret += goodnum % g[i] + b[i]
	if ret < n[i]:
		ret = n[i]
	print(ret)


def program():
	(n, g, b) = map(int, input().split())
	if g == b:
		print(n)
		return 0
	if n % 2 == 0:
		a = n // 2
	else:
		a = n // 2 + 1
	if g >= a:
		print(n)
		return 0
	if a % g == 0:
		print(max(n, a + (a // g - 1) * b))
	else:
		print(max(n, a + a // g * b))
t = int(input())
for i in range(t):
	program()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
	ok = mx
	ng = mn
	while ng + 1 < ok:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok

def check(m):
	(di, mo) = divmod(m, cycle)
	cnt = di * g + min(g, mo)
	return cnt >= tgt
for _ in range(INT()):
	(N, g, b) = MAP()
	tgt = ceil(N, 2)
	cycle = g + b
	res = bisearch_min(N - 1, INF, check)
	print(res)


import math
test = int(input())
for _ in range(test):
	liste = list(map(int, input().split()))
	len = liste[0]
	g = liste[1]
	b = liste[2]
	if g >= len:
		res = len
	else:
		half = math.ceil(len / 2)
		rep = half // g
		mod = half % g
		if mod == 0:
			tekrar = rep - 1
		else:
			tekrar = rep
		total = mod + tekrar * b + rep * g
		if total <= len:
			res = len
		else:
			res = total
	print(res)


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	(n, g, b) = invr()
	q = math.ceil(n / 2)
	if q <= g:
		print(n)
	else:
		w = (q - 1) // g
		qw = w * b
		print(max(n, q + qw))


t = int(input())
for i in range(t):
	n_g_b = list(map(int, input().split(' ')))
	(n, g, b) = n_g_b
	reqa = n // 2 + 1 if n % 2 == 1 else n // 2
	reqb = n - reqa
	if reqa // g > 0:
		if reqa % g == 0:
			fo_b = reqa // g - 1
			if reqb < fo_b * b:
				bday = (reqa // g - 1) * b
			else:
				bday = (reqa // g - 1) * b + (reqb - (reqa // g - 1) * b)
			days = g * (reqa // g) + bday
		else:
			fo_b = reqa // g
			if reqb < fo_b * b:
				bday = 0
			else:
				bday = reqb - reqa // g * b
			days = (g + b) * (reqa // g) + reqa % g + bday
	else:
		days = n
	print(days)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def main():
	t = inin()
	for _ in range(t):
		(z, x, y) = cin()
		p = min(y, x)
		a = p + x
		an = math.ceil(z / a) - 1
		ans = an * (y + x)
		f = ans - an * a
		f = max(0, f)
		z -= an * a
		ans += z - min(f, z // 2)
		print(ans)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


t = int(input())
for i in range(t):
	(n, g, b) = [int(i) for i in input().split()]
	polovina = n // 2 + n % 2
	tag = 0
	if n < g:
		print(n)
	elif polovina % g == 0:
		tag = polovina // g * g + b * (polovina // g - 1)
		if n <= tag:
			print(tag)
		else:
			tag += n - tag
			print(tag)
	else:
		tag = polovina // g * g + b * (polovina // g) + polovina % g
		if n <= tag:
			print(tag)
		else:
			tag += n - tag
			print(tag)


import math
for t in range(int(input())):
	(length, good, bad) = map(int, input().split())
	good_len = math.ceil(length / 2)
	complete_cycle_days = math.floor(good_len / good) * (good + bad)
	no_of_good_more = good_len - math.floor(good_len / good) * good
	if no_of_good_more == 0:
		complete_cycle_days -= bad
	complete_cycle_days += no_of_good_more
	print(max(length, complete_cycle_days))


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	goodBlock = int(math.ceil(math.ceil(n / 2) / g))
	print(max(goodBlock * g + (goodBlock - 1) * b - (goodBlock * g - math.ceil(n / 2)), n))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		target = n // 2 + n % 2
		ans = target // g * (b + g)
		if target % g:
			ans += target % g
		else:
			ans -= b
		print(max(n, ans))


from sys import stdin
from math import ceil
test_case = True
if test_case:
	t = int(stdin.readline())
	while t:
		t -= 1
		(n, g, b) = map(int, stdin.readline().split())
		if g >= n:
			ans = n
		else:
			high = ceil(n / 2)
			skip = (ceil(ceil(n / 2) / g) - 1) * b
			low = n - high
			ans = skip + high
			if low > skip:
				ans += low - skip
		print(ans)
else:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	ans = 0
	t = n // 2
	if n % 2 == 1:
		t += 1
	k = math.ceil(t / g)
	mod = g * k - t
	if k == 0:
		print(n)
	else:
		to = max(0, b * (k - 1)) + max(0, g * k)
		if to - mod > n:
			print(to - mod)
		else:
			print(n)


T = int(input())
while T:
	(n, g, b) = map(int, input().split())
	result = 0
	if g >= b:
		result += n
	else:
		temp = n + n % 2
		temp = temp // 2
		gr = temp // g
		if temp % g != 0:
			gr += 1
		n -= temp
		result += temp
		n -= (gr - 1) * b
		result += (gr - 1) * b
		if n > 0:
			result += n
	print(result)
	T -= 1


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		d = 0
		p = math.ceil(n / 2)
		q = n - p
		x = p // g
		y = p % g
		dg = x * g + y
		db = q // b * b + q % b
		if y == 0:
			e = (x - 1) * b
		else:
			e = x * b
		if db <= e:
			print(dg + e)
		else:
			print(dg + db)


import math
s = int(input())
for i in range(s):
	(n, g, b) = list(map(int, input().split()))
	if g >= b:
		print(n)
	else:
		r = math.ceil(n / 2)
		(c, d) = divmod(r, g)
		if d == 0:
			c -= 1
			d += g
		if (g + b) * c + d < n:
			print(n)
		else:
			print((g + b) * c + d)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	target = math.ceil(n / 2)
	gp = 0
	bp = 0
	isg = True
	ans = 0
	l = 0
	r = 10000000000.0
	x = 0
	while l <= r:
		mid = (l + r) // 2
		rem = n - mid * (g + b)
		gp = mid * g
		if gp + rem >= target and n - mid * (g + b) >= 0:
			x = int(mid)
			l = mid + 1
		else:
			r = mid - 1
	rem = n - x * (g + b)
	ans += x * (g + b)
	gp = x * g
	req = target - gp
	if req <= g:
		print(ans + rem)
	else:
		ans += g
		req -= g
		rem -= g
		rem1 = max(rem - req, 0)
		ans += b
		rem -= rem1
		y = rem // g
		ans += max(y * (g + b) - b, 0)
		rem -= y * g
		if rem > 0 and y > 0:
			ans += b
		ans += rem
		print(ans)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	req = n // 2 + n % 2
	gr = req // g
	if req % g:
		print(max(n, gr * (b + g) + req % g))
	else:
		print(max(n, (gr - 1) * (b + g) + g))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	print(max(((n + 1) // 2 + g - 1) // g * (g + b) - b - (((n + 1) // 2 + g - 1) // g * g - (n + 1) // 2), n))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = (n + 1) // 2
	totald = need // g * (g + b)
	if need % g > 0:
		print(max(totald + need % g, n))
	else:
		print(max(n, totald - b))


t = int(input())
for i in range(t):
	(n, g, b) = input().strip().split(' ')
	(n, g, b) = [int(n), int(g), int(b)]
	need = (n + 1) // 2
	tot = need // g * (b + g)
	if need % g == 0:
		tot -= b
	else:
		tot += need % g
	print(max(tot, n))


from sys import stdin
from math import ceil
T = int(stdin.readline())
tests = []
for t in range(T):
	(n, g, b) = [int(x) for x in stdin.readline().split(' ')]
	tests.append((n, g, b))
for test in tests:
	(n, g, b) = test
	count = 0
	availbad = n // 2
	coolticks = ceil(availbad / b)
	if n <= coolticks * g + availbad:
		print(n)
		continue
	count += coolticks * (g + b)
	n -= coolticks * g + availbad
	(moretick, remain) = divmod(n, g)
	count += moretick * (g + b) + remain
	if moretick >= 1 and remain == 0:
		print(count - b)
	else:
		print(count)


INF = 10 ** 10

def main():
	(n, g, b) = get_list()
	k = (n + 1) // 2
	ans = (g + b) * ((k - 1) // g) + k - (k - 1) // g * g
	print(max(n, ans))
import sys
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


from math import *
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	s = 0
	if g >= b:
		s = n
	else:
		k = ceil(n / 2)
		if k % g == 0:
			s = k + (k // g - 1) * b
		else:
			s = k + k // g * b
	print(max(s, n))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	(n, g, b) = sep()
	t = ceil(n / 2)
	ans = t // g * (g + b)
	if t % g == 0:
		ans -= b
	else:
		ans += t % g
	print(max(ans, n))
testcase(int(inp()))


t = int(input())
for i in range(0, t):
	lis = input()
	(leng, gday, bday) = lis.split()
	leng = int(leng)
	gday = int(gday)
	bday = int(bday)
	minlen = int((leng + 1) / 2)
	cycles = int(minlen / gday)
	minleft = minlen % gday
	if cycles == 0:
		days = leng
	elif minleft == 0:
		cyclelen = gday + bday
		gdayincycle = gday * (cycles - 1)
		leftgday = minlen - gdayincycle
		days = (cycles - 1) * cyclelen + leftgday
	else:
		cyclelen = gday + bday
		gdayincycle = gday * cycles
		leftgday = minlen - gdayincycle
		days = cycles * cyclelen + leftgday
	if days < leng:
		days = leng
	print(days)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d

def divup(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1
t = int(input())
for q in range(t):
	(n, g, b) = inputnums()
	goal = math.ceil(n / 2)
	days = (g + b) * (goal // g)
	if goal % g == 0:
		print(max(n, days - b))
	else:
		print(max(n, days + goal % g))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	mb = n // 2 // b
	rm_b = n // 2 % b
	p = (g + b) * mb
	remain = n - p
	if remain <= g + rm_b:
		print(p + remain)
	else:
		days = p + (g + b)
		remain -= g + rm_b
		if remain % g == 0:
			print(days + remain // g * (g + b) - b)
		else:
			print(days + remain // g * (g + b) + remain % g)


for ti in range(int(input())):
	(n, g, b) = [int(x) for x in input().split()]
	ans = 0
	if g >= n:
		print(n)
		continue
	ans += g
	gr = (n + 1) // 2
	br = n - gr
	gr -= g
	ms = gr // g
	ans += ms * (g + b)
	gr -= ms * g
	br -= ms * b
	br = max(br, 0)
	if gr:
		gl = min(gr, g)
		gr -= gl
		ans += gl + b
		br -= b
	if br > 0:
		ans += br
	print(ans)


import math
p = int(input())
for i in range(p):
	(num, g, b) = map(int, input().split())
	cycles = math.ceil(math.ceil(num / 2) / g)
	out = (cycles - 1) * b + math.ceil(num / 2)
	print(max(num, out))


import math
t = int(input())
for _ in range(t):
	(n, g, b) = list(map(int, input().split()))
	iteri = 0
	gn = (n + 1) // 2
	iteri = math.ceil(gn / g)
	print(max(b * (iteri - 1) + gn, n))


T = int(input())
for q in range(T):
	(n, g, b) = map(int, input().split())
	if g >= (n + 1) // 2:
		ans = n
	else:
		ans1 = (n + 1) // 2
		ans2 = n // 2
		ans3 = ans4 = 0
		if ans1 % g == 0:
			ans3 = ans1 // g
		else:
			ans3 = ans1 // g + 1
		ans3 -= 1
		ans = ans1 + ans3 * b
		if n >= ans:
			ans = n
	print(ans)


from math import *
for i in range(int(input())):
	(m, g, b) = map(int, input().split())
	needG = int(ceil(m / 2))
	mul = needG // g
	totalG = mul * (g + b)
	M = needG % g
	if needG % g == 0:
		totalG -= b
	else:
		totalG += M
	print(max(m, totalG))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	q = n // 2 + n % 2
	ans = 0
	if q % g == 0:
		ans = q // g
		ans = ans * g + (ans - 1) * b
	else:
		ans = q // g + 1
		ans = (ans - 1) * (g + b) + q % g
	print(max(n, ans))


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	score = int(ceil(n / 2))
	if b > g:
		fac = ceil(score / g)
		if fac == 1:
			print(n)
		else:
			x = (g + b) * (fac - 1)
			print(x + max(score - (fac - 1) * g, n - (fac - 1) * (g + b)))
	else:
		print(n)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b or 2 * g >= n:
		print(n)
	else:
		h = (n + 1) // 2
		rh = n - h
		m = h - g
		d = m // g
		r = m % g
		bads = b * d
		if r > 0:
			bads += b
		if r == 0:
			days = g + (b + g) * d + max(0, rh - bads)
		else:
			days = g + (b + g) * d + b + r + max(0, rh - bads)
		print(days)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	r = (n + 1) // 2
	k = r // g
	x = r % g
	print(max(n, (k - 1) * b + r if x == 0 else k * b + r))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	aim = n // 2 + n % 2
	good = (g + b) * (aim // g) + aim % g
	if aim % g == 0:
		good -= b
	print(max(n, good))


kl = int(input())
for l in range(kl):
	(n, g, b) = [int(i) for i in input().split()]
	if g >= b or g >= (n + 1) // 2:
		print(n)
	else:
		k = (n + 1) // 2 // g
		if (n + 1) // 2 % g == 0:
			k -= 1
		rz = (n + 1) // 2 + k * b
		if n - rz > 0:
			d = n - rz
		else:
			d = 0
		print(rz + d)


N = int(input())
for _ in range(N):
	(n, g, b) = map(int, input().split())
	need = (n + 1) // 2
	if need <= g:
		print(n)
		continue
	k = need // g
	t = need % g
	ans = k * (g + b) - b
	if t:
		ans += b
		ans += t
	print(max(ans, n))


import math
for nt in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= math.ceil(n / 2):
		print(n)
		continue
	print(max((math.ceil(math.ceil(n / 2) / g) - 1) * b + math.ceil(n / 2), n))


T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split())
	request = (n + 1) // 2
	if request % g == 0:
		cnt = request // g
		result = max(cnt * (b + g) - b, n)
	else:
		cnt = request // g + 1
		result = max((cnt - 1) * (b + g) + request - (cnt - 1) * g, n)
	if request <= g:
		result = n
	print(result)


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	half = ceil(n / 2)
	good_needed = ceil(half / g)
	total = 0
	total = (good_needed - 1) * g
	total += half - total
	total += (good_needed - 1) * b
	if total < n:
		print(n)
	else:
		print(total)


import math
t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	n1 = math.ceil(n / 2)
	ans = n1
	g1 = n1 // g
	if n1 % g == 0:
		b1 = g1 - 1
	else:
		b1 = g1
	ans = g1 * g + b * b1
	n1 = n1 - g1 * g
	ans += n1
	ans = max(n, ans)
	print(ans)


t = int(input())
while t > 0:
	(n, g, b) = map(int, input().split())

	def can(k):
		v = k // (g + b)
		cnt = v * g
		cnt += min(g, k % (g + b))
		return cnt >= (n + 1) // 2
	st = n
	nd = 5 * 10 ** 18
	ans = 10 ** 19
	while st <= nd:
		mid = (st + nd) // 2
		if can(mid):
			ans = min(ans, mid)
			nd = mid - 1
		else:
			st = mid + 1
	print(ans)
	t -= 1


def solve(n, a, b):
	if a >= b:
		print(n)
	else:
		days = 0
		bad_days = n // 2
		period_bad = bad_days // b
		q = bad_days % b
		days += (a + b) * period_bad
		rem = n - days
		if rem <= a + q:
			days += rem
			print(days)
			return
		else:
			days += a + b
			rem -= a + q
		(pp, qq) = (rem // a, rem % a)
		if pp == 0:
			days += qq
		elif qq == 0:
			days += (a + b) * (pp - 1) + a
		else:
			days += (a + b) * pp + qq
		print(days)
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	solve(n, a, b)


m = int(input())
for i in range(m):
	(n, g, b) = map(int, input().split(' '))
	num = (n + 1) // 2
	if num % g != 0:
		sum = num // g * (g + b) + num % g
	else:
		sum = num // g * (g + b) - b
	print(max(sum, n))


inputNum = int(input())
ansList = []
for i in range(inputNum):
	(n, g, b) = map(int, input().split())
	minGD = int(n / 2) + n % 2
	minCycle = int(minGD / g)
	if minGD % g > 0:
		minCycle += 1
	totalDays = minGD + (minCycle - 1) * b
	if n > totalDays:
		totalDays = n
	ansList.append(totalDays)
for i in ansList:
	print(i)


q = int(input(''))
for z in range(0, q):
	p = list(map(int, input().split()))
	a = p[0]
	b = p[1]
	c = p[2]
	l = a // 2
	t = 0
	if a % 2 != 0:
		l += 1
	if b >= l:
		t = a
	else:
		s = l // b
		if l > b * s:
			s += 1
		t = b * s + c * (s - 1)
		if b * s > l:
			t = t + (l - b * s)
		if t < a:
			t = a
	print(t)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(n, g, b) = ria()
		d = g
		tg = int(math.ceil(n / 2))
		tb = n - tg
		ans = tg // g * (g + b)
		if tg % g == 0:
			ans -= b
		else:
			ans += tg % g
		print(max(n, ans))
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	(n, g, b) = list(map(int, sys.stdin.readline().split()))
	if n - int(n / 2) <= g or g >= b:
		print(n)
	else:
		if int(n / 2) > b:
			p = int(int(n / 2) / b)
			re = (g + b) * p
			maked = re
			if int(n / 2) % b != 0:
				re += g + b
				maked += g + int(n / 2) % b
			if maked >= n:
				print(n)
				continue
			i = n - maked
			re += int(i / g) * (g + b) + i % g
			if i % g == 0:
				re -= b
		else:
			maked = int(n / 2) + g
			re = g + b
			i = n - maked
			re += int(i / g) * (g + b) + i % g
			if i % g == 0:
				re -= b
		print(re)


for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	nn = (n + 1) // 2
	print(max(nn + (nn - 1) // g * b, n))


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	(n, g, b) = map(int, sys.stdin.readline().split(' '))
	x = (n + 1) // 2
	gg = x // g
	ans = 0
	if gg * g < x:
		gg += 1
	if gg > 1:
		ans = (gg - 1) * b + x
	else:
		ans = x
	print(max(ans, n))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


from sys import stdin
input = lambda : stdin.readline().strip()
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = (n + 1) // 2
	y = x - 1
	ans = max(x + y // g * b, n)
	print(ans)


def main():
	t = int(input())
	for _ in range(t):
		(n, g, b) = map(int, input().split())

		def cond(m):
			k = m // (g + b)
			good = k * g
			bad = k * b
			k = m - k * (g + b)
			if k <= g:
				good += k
			else:
				good += g
				bad += k - g
			p1 = (n + 1) // 2
			p2 = n - p1
			if good >= p1 and bad >= n - good:
				return True
			else:
				return False
		l = 1
		r = 10 ** 18
		ans = -1
		while l <= r:
			m = (r - l) // 2 + l
			if cond(m):
				r = m - 1
				ans = m
			else:
				l = m + 1
		print(ans)
	return
main()


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	d = math.ceil(n / 2)
	if g >= d:
		print(n)
	else:
		k = math.ceil(d / g)
		if (k - 1) * b + d >= n:
			if d % g == 0:
				print((g + b) * k + d % g - b)
			else:
				print((g + b) * (k - 1) + d % g)
		else:
			print(n)


for i in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	d = g
	n2 = n // 2 + (1 if n % 2 == 1 else 0)
	n2 -= g
	k = n2 // g + (1 if n2 % g != 0 else 0)
	d += b * k
	d += n2
	print(max(d, n))


t = int(input())
ans = []
for i in range(t):
	(l, g, b) = map(int, input().strip().split())
	totalG = 0
	needG = (l + 1) // 2
	totalG = needG // g * (b + g)
	if needG % g == 0:
		totalG -= b
	else:
		totalG += needG % g
	ans.append(max(totalG, l))
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	(n, d, l) = map(int, input().split())
	g = n
	if n % 2 == 0:
		n //= 2
	else:
		n //= 2
		n += 1
	if n % d == 0:
		if (n // d - 1) * (d + l) + d < g:
			print(g)
		else:
			print((n // d - 1) * (d + l) + d)
	elif n // d * (d + l) + n % d < g:
		print(g)
	else:
		print(n // d * (d + l) + n % d)


import math
t = int(input())
while t > 0:
	(n, g, b) = [int(x) for x in input().split(' ')]
	if g >= n:
		print(n)
	else:
		n1 = int(math.ceil(n / 2))
		r = n1
		if n1 % g == 0:
			r = r + b * (n1 // g - 1)
		else:
			r = r + b * (n1 // g)
		if r >= n:
			print(int(r))
		else:
			print(n)
	t -= 1


import math
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	g = int(l[1])
	b = int(l[2])
	mina = math.ceil(n / 2)
	if mina % g == 0:
		z = mina // g - 1
	else:
		z = mina // g
	if z * (g + b) + (mina - g * z) >= n:
		ans = z * (g + b) + (mina - g * z)
	else:
		ans = n
	print(ans)


def solution():
	from sys import stdin, stdout
	(_input, _print, _range, _int, _len, _str) = (stdin.readline, stdout.write, range, int, len, str)
	for _ in _range(_int(_input())):
		(n, g, b) = [_int(i) for i in _input().split()]
		counter = 0
		great = n // 2 if n % 2 == 0 else n // 2 + 1
		while n > 0 or great > 0:
			if n > g + b:
				days = n // (g + b)
				counter += days * (g + b)
				great -= days * g
				n %= g + b
			elif great > 0 and great > g:
				days = great // g
				counter += days * (g + b)
				n -= days * (g + b)
				great %= g
				if great == 0 and n + b <= 0:
					counter -= b
			elif great == 0 and n > 0:
				counter += n
				n = 0
			else:
				counter += great
				n -= great
				great = 0
		_print(_str(counter) + '\n')
solution()


from math import ceil
t = int(input())
while t > 0:
	a = input().split(' ')
	n = int(a[0])
	g = int(a[1])
	b = int(a[2])
	if g >= ceil(n / 2):
		print(n)
	elif g >= b:
		print(n)
	else:
		half = ceil(n / 2)
		cycles = half // g
		if half % g == 0:
			cycles -= 1
		ans = max(cycles * b + half, n)
		print(int(ans))
	t -= 1


T = int(input())
for _ in range(0, T):
	(n, g, b) = map(int, input().split())
	N = n
	trg = n // 2
	if g >= b:
		print(n)
	else:
		allw = trg // b
		rem = trg % b
		if n <= allw * (g + b):
			print(n)
		else:
			n -= allw * (g + b)
			ans = allw * (g + b)
			n -= g + rem
			ans += g + b
			if n <= 0:
				print(N)
			else:
				temp = n // g
				if n % g == 0:
					ans += (temp - 1) * (g + b) + g
				else:
					ans += temp * (g + b) + n % g
				print(ans)


import math
t = int(input())
for d in range(t):
	l = [int(x) for x in str(input()).split()]
	n = l[0]
	g = l[1]
	b = l[2]
	if n < g:
		print(n)
		continue
	m = math.ceil(n / 2)
	td = g + b
	s = m // g
	if m % g == 0:
		print(max(n, s * td + m % g - b))
	else:
		print(max(n, s * td + m % g))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		total = g + b
		y = math.ceil(n / 2)
		d = y // g
		ans = d * total
		work = y
		if y - d * g > 0:
			ans = ans + y - d * g
		else:
			ans = ans - b
		print(max(ans, n))


for _ in range(int(input())):
	(n, g, b) = [int(__) for __ in input().split()]
	shit = n - n // 2
	ans = 0
	if shit % g == 0:
		ans = shit + (shit // g - 1) * b
	else:
		ans = shit + shit // g * b
	if ans < n:
		print(n)
	else:
		print(ans)


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	ans = n
	nans = 0
	nd = (n + 1) // 2
	gb = g + b
	t1 = nd / g
	t2 = int(t1) * gb
	if t1 % 1 == 0:
		print(max(ans, t2 - b))
	else:
		t3 = round(t1 % 1 * g)
		print(max(ans, t2 + t3))


q = int(input())
for u in range(q):
	(n, g, b) = [int(i) for i in input().split()]
	n1 = (n + 1) // 2
	if n1 <= g:
		print(n)
	else:
		p = n1 // g
		m = n1 % g
		if m == 0:
			if g * p + b * (p - 1) >= n:
				print(g * p + b * (p - 1))
			else:
				print(n)
		elif g * p + b * p + m >= n:
			print(g * p + b * p + m)
		else:
			print(n)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split(' '))
	l = n - 1
	r = 50000000000000000000
	while l + 1 != r:
		mid = (l + r) // 2
		full = mid // (g + b)
		fullMod = mid % (g + b)
		good_m = 0
		if fullMod // g >= 1:
			good_m = g
		else:
			good_m = fullMod
		good = full * g + good_m
		if good >= n // 2 + n % 2:
			r = mid
		else:
			l = mid
	print(r)


t = int(input())
for i in range(t):
	(n, g, b) = input().split(' ')
	n = int(n)
	b = int(b)
	g = int(g)
	m = int(n / 2)
	if n % 2 != 0:
		m = m + 1
	ans = 0
	if m < g or m == g:
		ans = n
	else:
		q = int(m / g)
		r = m % g
		if r == 0:
			ans = (q - 1) * (g + b) + g
		elif r > 0:
			ans = q * (g + b) + int(r)
	if ans < n:
		ans = n
	print(ans)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, sys.stdin.readline().split()))

def num():
	return map(int, sys.stdin.readline().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007

def solve():
	t = nu()
	for tt in range(t):
		(n, g, b) = num()
		tobe = int(ma.ceil(n / 2))
		bad = 0
		up = tobe // g
		rem = 0
		if up * g != tobe:
			rem = tobe - up * g
		hp = g * up + b * (up - 1)
		bad = b * (up - 1)
		if rem != 0:
			hp += b + rem
			bad += b
		if bad + tobe < n:
			la = n - bad - tobe
			hp += la
		if up == 0:
			hp = n
		print(hp)
solve()


T = int(input())
import math
for i in range(T):
	(n, g, b) = map(int, input().split())
	gx = math.ceil(n / 2)
	bx = n // 2
	C = math.ceil(gx / g)
	if (C - 1) * b >= bx:
		print((C - 1) * b + gx)
	else:
		print((C - 1) * b + gx + (bx - (C - 1) * b))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = n // 2 + n % 2
	if g >= need:
		print(n)
		continue
	else:
		tot = need // g
		ans = tot * (g + b)
		if need % g:
			ans += need % g
		else:
			ans -= b
	print(max(ans, n))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	l = 0
	d = n // 2 + n % 2
	tc = g + b
	r = 100000000000000000001
	while l + 1 < r:
		m = (l + r) // 2
		if m < n:
			l = m
			continue
		tec = m // tc
		k1 = g * tec
		k2 = b * tec
		if m - tc * tec > g:
			k1 += g
			k2 += b - (m - tc * tec - g)
		elif m > tc * tec:
			k1 += m - tc * tec
		if k1 >= d:
			r = m
		else:
			l = m
	print(r)


tt = int(input())
while tt > 0:
	(n, g, b) = [int(x) for x in input().split()]
	days = 0
	req = n // 2
	if req * 2 != n:
		req += 1
	ch = req // g
	if g >= n:
		print(n)
		tt -= 1
		continue
	days += ch * g + (ch - 1) * b
	if ch * g < req:
		days += b
		days += req - ch * g
	if days < n:
		days += n - days
	print(days)
	tt -= 1


import math
for t in range(int(input())):
	(n, g, b) = map(int, input().split())
	m = math.ceil(n / 2)
	groups = math.ceil(m / g)
	ans = m + (groups - 1) * b
	print(max(ans, n))


t = int(input())
for k in range(t):
	(n, g, b) = map(int, input().split())
	z = n // 2 + n % 2
	h = (z - 1) // g
	al = h * (b + g) + (z - h * g)
	print(al + max(0, n - al))


x = int(input())
for i in range(x):
	(n, g, b) = map(int, input().split())
	a = 0
	days = 0
	if n % 2 == 0:
		a = n // 2
	else:
		a = n // 2 + 1
	if g >= n:
		print(n)
	elif g >= a:
		print(n)
	else:
		if a % g == 0:
			bdays = (a // g - 1) * b
			days = days + a // g * g + bdays + a % g
		else:
			bdays = a // g * b
			days = days + a // g * g + bdays + a % g
		if bdays < n - a:
			days = days + (n - a - bdays)
			print(days)
		else:
			print(days)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	no_seg = n // 2 // b
	if no_seg * (g + b) + g + n // 2 % b >= n:
		print(n)
		continue
	pending = n - (no_seg * (g + b) + g + n // 2 % b)
	no_seg += 1
	no_seg += pending // g
	ans = no_seg * (g + b) + pending % g
	if pending % g == 0:
		ans -= b
	print(ans)


arr = []
test_cases = int(input(''))
for x in range(test_cases):
	a = []
	a = list(map(int, input().split()))
	arr.append(a)
for y in range(test_cases):
	p = arr[y][0]
	G = arr[y][1]
	B = arr[y][2]
	min = int(p / 2 + 0.5)
	q = int(min / G)
	mod = min % G
	if mod == 0:
		ans = q * (G + B) - B
	else:
		ans = q * (G + B) + mod
	print(max(ans, p))


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	(n, g, b) = int_array()
	x = ceil(n / 2)
	pairs = ceil(x / g) - 1
	ans = pairs * (g + b)
	rem = x - pairs * g
	ans += rem
	print(max(ans, n))


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	half = math.ceil(n / 2)
	how = math.ceil(half / g)
	ans = b * (how - 1) + g * (how - 1) + half - g * (how - 1)
	if ans < n:
		ans += n - ans
	print(ans)


import math
for T in range(int(input().strip())):
	(n, g, b) = [int(i) for i in input().strip().split(' ')]
	ans = 0
	n1 = n // 2 + n % 2
	n2 = n - n1
	rem = g if n1 % g == 0 else n1 % g
	c1 = n1 // g - 1 if n1 % g == 0 else n1 // g
	n2 = max(0, n2 - c1 * b)
	rem = rem + n2
	ans = c1 * (g + b) + rem
	print(ans)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	ok = 10 ** 20
	ng = -1
	half = (n + 1) // 2
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if mid < n:
			ng = mid
		else:
			p = mid // (g + b) * g + min(g, mid % (g + b))
			if p >= half:
				ok = mid
			else:
				ng = mid
	print(ok)


import math
t = int(input())
a = []
for i in range(t):
	b = list(map(int, input().split()))
	a.append(b)
for i in a:
	k = i[0]
	a = i[1]
	b = i[2]
	if b > a:
		p = math.ceil(i[0] / 2)
		l = int(p // a)
		if p % a != 0:
			n = l * (a + b) + p % a
		else:
			n = l * a + (l - 1) * b
		if n < k:
			print(k)
		else:
			print(n)
	else:
		print(k)


import math
t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	good = math.ceil(n / 2)
	total = good // g * (g + b)
	if good % g > 0:
		total += good % g
	else:
		total -= b
	print(max(n, total))


from math import ceil, floor
T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split(' '))
	if g >= b:
		print(n)
	else:
		td = (ceil(ceil(n / 2) / g) - 1) * (g + b)
		gd = ceil(n / 2) - (ceil(ceil(n / 2) / g) - 1) * g
		ld = max(floor(n / 2) - (ceil(ceil(n / 2) / g) - 1) * b, 0)
		print(td + ld + gd)


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	a = math.ceil(n / 2)
	if g >= n:
		print(n)
	else:
		u = a // g
		h = a % g
		p = u * (g + b)
		if h > 0:
			p += h
		else:
			p -= b
		print(max(n, p))


import math

def sol(l):
	(n, g, b) = list(map(int, l.split()))
	a = math.ceil(n / 2)
	c = math.floor(a / g) * (b + g)
	if a % g == 0:
		c -= b
	else:
		c += a % g
	return math.ceil(max(c, n))

def main():
	n = int(input())
	for l in range(n):
		print(sol(input()))
main()


import math
s = []
for i in range(int(input())):
	s.append(input())

def find_optimal(pattern):
	(n, good_d, bad_d) = map(int, pattern.split())
	min_high_q = math.ceil(n / 2)
	if good_d >= bad_d or good_d >= n:
		return n
	total = math.ceil(min_high_q / good_d - 1) * bad_d + min_high_q
	if total >= n:
		return total
	return total + (n - total)
for i in s:
	print(find_optimal(i))


import math
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = math.ceil(n / 2)
	total = need // g * (g + b)
	if need % g == 0:
		total -= b
	else:
		total += need % g
	print(max(n, total))


for _ in range(int(input())):
	(n, g, b) = [int(x) for x in input().split()]
	hG = int(n / 2 + 0.5)
	ans = int(hG / g) * (g + b)
	ans += -b if hG % g == 0 else hG % g
	print(max(ans, n))


from math import ceil
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	half = (n + 1) // 2
	totalg = half // g * (g + b)
	if half % g > 0:
		totalg += half % g
	elif half % g == 0:
		totalg -= b
	print(max(n, totalg))


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))
mo = 1000000007
for _ in range(inn()):
	(n, a, b) = value()
	if n <= a:
		print(n)
		continue
	cg = n // 2
	if n % 2 != 0:
		cg += 1
	res1 = cg // a
	if cg % a == 0:
		res1 -= 1
	res2 = b * res1
	bg = n - cg
	if res2 >= bg:
		ans = res2
		ans += cg
		print(ans)
	else:
		ans = res1 * a + res2
		cg -= res1 * a
		bg -= res2
		ans += min(a, cg + bg)
		val = a - cg
		bg = max(0, bg - val)
		ans += bg
		print(ans)


t = int(input())
for case_num in range(t):
	(n, g, b) = map(int, input().split(' '))
	if g >= n:
		print(n)
	else:
		target = (n + 1) // 2
		cycle = (target - 1) // g
		ans = cycle * b + target
		print(max(ans, n))


from math import ceil
from math import sqrt
from math import factorial
from collections import Counter
from operator import itemgetter
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
t = ii()
for _ in range(t):
	(n, g, b) = iia()
	t = ceil(n / 2)
	ans = 0
	if t // g == ceil(t / g):
		ans = max(n, (t // g - 1) * (g + b) + g)
	else:
		ans = max(n, t // g * (g + b) + (t - t // g * g))
	print(ans)


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	mn = int(ceil(n / 2))
	conf = mn // g
	rmm = mn % g
	rmn = n - mn
	gdt = conf
	days = (g + b) * gdt
	bdays = b * gdt
	if rmm == 0:
		days -= b
		bdays -= b
	else:
		days += rmm
	if rmn > bdays:
		days += rmn - bdays
	print(days)


def mi():
	return map(int, input().split())
for _ in range(int(input())):
	(n, g, b) = mi()
	t = (n + 1) // 2
	(lo, hi) = (0, n * (g + b))
	ans = hi
	while lo < hi:
		mid = (lo + hi) // 2
		if mid // (g + b) * g + min(g, mid % (g + b)) >= t and mid >= n:
			ans = mid
			hi = mid
		else:
			lo = mid + 1
	print(ans)


for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	mini = n // 2
	if n % 2 == 1:
		mini += 1
	if g >= mini:
		print(n)
	else:
		gwd = 0
		bwd = 0
		badwork = 0
		co = 0
		flag = 0
		co = mini // g
		if mini % g != 0:
			co += 1
		gwd = mini
		bwd = b * (co - 1)
		if gwd + bwd >= n:
			print(gwd + bwd)
		else:
			ans = n - (gwd + bwd)
			print(gwd + bwd + ans)


import math
t = int(input())
for i in range(t):
	num_input = input()
	num_input = num_input.split(' ')
	n = int(num_input[0])
	g = int(num_input[1])
	b = int(num_input[2])
	valid_length = math.ceil(n / 2)
	cycle = valid_length // g
	if valid_length % g != 0:
		days = cycle * (g + b) + valid_length % g
	else:
		days = cycle * g + (cycle - 1) * b
	if days < n:
		days = n
	print(days)


from math import ceil
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	half_n = ceil(n / 2)
	ans = 0
	if half_n > g:
		day = ceil(half_n / g) - 1
		ans = day * (g + b) + (half_n - day * g)
	else:
		ans = half_n
	print(max(ans, n))


import math
num_cases = int(input())
for i in range(num_cases):
	array = [int(n) for n in input().split()]
	half = math.ceil(array[0] / 2)
	cycles = half // array[1]
	extra = half % array[1]
	total = cycles * (array[1] + array[2]) + extra
	if extra == 0:
		total -= array[2]
	print(str(max(array[0], total)))


from math import ceil

def solve(n, g, b):
	n_copy = n
	if n <= g:
		return n
	res = 0
	total = g + b
	allowed = n // 2
	temp = allowed // b
	res += total * temp
	allowed -= b * temp
	n -= res
	if n <= 0:
		return n_copy
	if allowed:
		if n <= g + allowed:
			return n_copy
		res += total
		n = n - (g + allowed)
		allowed = 0
	res += total * (n // g)
	res += n % g
	if n % g == 0:
		res -= b
	return res
for t in range(int(input())):
	(n, g, b) = [int(i) for i in input().split()]
	print(solve(n, g, b))


for i in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	t = (a + 1) // 2
	l = t - 1
	print(max(a, l // b * c + t))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		y = (n + 1) // 2
		f = b + g
		a = n // f
		x = a * g
		d = y - x
		j = (d + g - 1) // g
		z = a * g + j * g
		r = a * f + j * f - b
		k = z - y
		l = r - n
		if l >= k:
			print(r - k)
		else:
			print(r - l)


from sys import stdin, stdout
import math
t = int(stdin.readline().strip())
for _ in range(t):
	(n, g, b) = stdin.readline().strip().split(' ')
	(n, g, b) = (int(n), int(g), int(b))
	hq = int(math.ceil(n / 2))
	lq = n - hq
	t1 = hq // g
	t2 = hq % g
	t3 = g - hq % g
	if t2 == 0:
		lqt = (t1 - 1) * b
		if lqt >= lq:
			ans = t1 * g + (t1 - 1) * b
		else:
			ans = t1 * g + (t1 - 1) * b + (lq - lqt)
	else:
		lqt = t1 * b
		if lqt >= lq:
			ans = t1 * (b + g) + t2
		else:
			ans = t1 * (b + g) + t2 + (lq - lqt)
	stdout.write(str(ans) + '\n')


T = int(input())
from math import ceil
for t in range(T):
	(n, g, b) = map(int, input().strip().split())
	r = (n + 1) // 2
	m = r // g * (g + b)
	if not r % g:
		m -= b
	else:
		m += r % g
	print(max(m, n))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	m = math.ceil(n / 2)
	atgood = math.ceil(m / g)
	sub = g * atgood - m
	negdays = b * (atgood - 1)
	atgood *= g
	atgood -= sub
	total = atgood + negdays
	if total >= n:
		print(total)
	else:
		total += n - total
		print(total)


import math
T = int(input())
for test in range(T):
	(n, g, b) = map(int, input().split())
	num_g = (n + 1) // 2
	if g >= b or g >= n:
		print(n)
	else:
		k = num_g // g
		cur = (k - 1) * (g + b) + g
		if num_g % g > 0:
			cur += b + (num_g - k * g)
		print(max(n, cur))


t = int(input())
for test in range(t):
	l = list(map(int, input().split()))
	length = l[0]
	good = l[1]
	bad = l[2]
	if length % 2 != 0:
		min_gdays = length // 2 + 1
	else:
		min_gdays = length // 2
	unit = good + bad
	extra_gdays = min_gdays % good
	cycles = min_gdays // good
	gdn = cycles * good
	if min_gdays % good != 0:
		ans = cycles * unit + (min_gdays - gdn)
	else:
		ans = cycles * unit - bad
	if ans < length:
		ans = length
	if good >= length:
		print(length)
	elif good + bad >= length:
		if min_gdays <= good:
			print(length)
		else:
			print(ans)
	else:
		print(ans)


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	h = (n + 1) // 2
	r = n - h
	cntg = (h + g - 1) // g
	ansg = h + (cntg - 1) * b
	ansg += max(0, n - ansg)
	print(ansg)


import math
s = []
for i in range(int(input())):
	s.append(input())

def working(pattern):
	(n, good_d, bad_d) = map(int, pattern.split(' '))
	min_high_q = math.ceil(n / 2)
	if good_d >= bad_d or good_d >= n:
		return n
	good_cycles = min_high_q / good_d
	bad_cycles = int(math.floor(good_cycles)) if good_cycles > math.floor(good_cycles) else int(math.floor(good_cycles)) - 1
	if bad_cycles * bad_d + min_high_q >= n:
		return bad_cycles * bad_d + min_high_q
	return bad_cycles * bad_d + min_high_q + (n - (bad_cycles * bad_d + min_high_q))
for i in s:
	print(working(i))


import math
t = int(input())
anss = []
while t:
	(n, a, b) = map(int, input().split())
	ans = 0
	if a >= b:
		ans = n
	else:
		m = math.ceil(n / 2)
		if m % a == 0:
			ans = m + (m // a - 1) * b
		else:
			ans = m + m // a * b
	anss.append(max(ans, n))
	t = t - 1
for i in anss:
	print(i)


from math import ceil
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	need = ceil(n / 2)
	cur_good = n // (b + g) * g
	days = n // (b + g) * (b + g)
	if cur_good < need:
		if need - cur_good > g:
			days += (ceil((need - cur_good) / g) - 1) * (g + b)
			cur_good = days // (b + g) * g
		days += max(need - cur_good, 0)
		cur_good += max(need - cur_good, 0)
	print(max(n, days))


for _ in ' ' * int(input()):
	(n, g, b) = map(int, input().split())
	print(max(n, (n + 1) // 2 // g * (g + b) + (n + 1) // 2 - (n + 1) // 2 // g * g if (n + 1) // 2 - (n + 1) // 2 // g * g else (n + 1) // 2 // g * (g + b) - b))


from math import ceil, floor
from collections import defaultdict
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if ceil(n / 2) <= g:
		print(n)
	else:
		x = ceil(n / 2)
		cnt = x // g
		if x % g:
			u = x % g
			ans = cnt * (g + b) + u
		else:
			ans = cnt * (g + b) - b
		print(max(n, ans))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	ne = math.ceil(n / 2)
	if ne % g == 0:
		a = ne // g * (g + b) - b
	else:
		a = ne // g * (g + b) + ne % g
	print(max(a, n))


from math import ceil

def f(n, a, b):
	days = ceil(n / 2)
	req = days
	grps = (ceil(req / a) - 1) * b
	return max(grps + days, n)
for i in range(int(input())):
	(a, b, c) = map(int, input().strip().split())
	print(f(a, b, c))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	p = g + b
	m = n // 2
	p1 = n // p
	p2 = n % p
	bad = p1 * b
	if p2 >= g:
		bad += p2 - g
	if bad <= m:
		print(n)
	else:
		n -= m
		g1 = n // g
		g2 = n % g
		if g2 != 0:
			print(p * g1 + g2)
		else:
			print(p * (g1 - 1) + g)


import sys
debug = False
if debug:
	invoer = open('test', 'r')
else:
	invoer = None

def line():
	if debug:
		return invoer
	else:
		return sys.__stdin__
sys.stdin = line()
test_cases = int(input())

def solve(n, g, b):
	good = n // 2 if n % 2 == 0 else n // 2 + 1
	loops = good / g
	if int(good + max(0, int(loops - 1 if loops.is_integer() else loops)) * b) > n:
		return int(good + max(0, int(loops - 1 if loops.is_integer() else loops)) * b)
	return n
for _ in range(test_cases):
	(n, g, b) = [int(i) for i in input().split(' ')]
	print(solve(n, g, b))
if debug:
	invoer.close()


from math import ceil

def main():
	t = int(input())
	while t > 0:
		(n, g, b) = map(int, input().split(' '))
		goalDays = ceil(n / 2)
		b_rem = (ceil(goalDays / g) - 1) * b
		neededDays = n - (goalDays + b_rem)
		days = goalDays + b_rem + max(neededDays, 0)
		print(days)
		t -= 1
main()


import math
t = int(input())
while t > 0:
	t -= 1
	lis = list(map(int, input().split()))
	n = lis[0]
	g = lis[1]
	b = lis[2]
	if g >= math.ceil(n / 2):
		print(n)
		continue
	good = math.ceil(n / 2)
	bad = n - good
	p = good // g
	q = good // g - 1
	ans = p * g + q * b
	good = good - p * g
	bad = bad - q * b
	if good > 0:
		ans += good
		ans += b
		bad -= b
	if bad > 0:
		ans += bad
	print(ans)


from math import ceil
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	print(ceil(n / 2) + ceil(ceil(n / 2) / g - 1) * b) if n - ceil(n / 2) <= ceil(ceil(n / 2) / g - 1) * b else print(n)


import math
for i in range(int(input())):
	(n, good_d, bad_d) = map(int, input().split())
	min_high_q = math.ceil(n / 2)
	if good_d >= bad_d or good_d >= n:
		print(n)
		continue
	total = math.ceil(min_high_q / good_d - 1) * bad_d + min_high_q
	if total >= n:
		print(total)
		continue
	print(total + (n - total))


import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	half = n + 1 >> 1
	if g >= b:
		ans = n
	elif half % g == 0:
		ans = max(half + (half // g - 1) * b, n)
	else:
		ans = max(half + half // g * b, n)
	print(ans)


from math import ceil
t = int(input())
while t > 0:
	(n, g, b) = map(int, input().strip().split())
	nby2 = ceil(n / 2)
	no_bad_days = (ceil(nby2 / g) - 1) * b
	day = nby2 + no_bad_days
	day += n - day if n - day > 0 else 0
	print(day)
	t -= 1


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	n1 = math.ceil(n / 2)
	ans = t = t1 = t2 = k = 0
	if n1 <= g:
		ans = n
	elif b >= g:
		t1 = n1 // g
		t2 = n1 - t1 * g
		if t2 == 0:
			k = (t1 - 1) * b
			ans = k + n1
		else:
			k = t1 * b
			ans = k + n1
	else:
		ans = n
	if ans < n:
		print(n)
	else:
		print(ans)


import math, collections, sys
input = sys.stdin.readline

def case():
	(n, g, b) = map(int, input().split())
	req = (n + 1) // 2
	gc = req // g
	if req % g:
		days = gc * (b + g)
		days += req % g
		rem = n - days
		days += max(rem, 0)
	else:
		days = gc * g + (gc - 1) * b
		rem = n - days
		days += max(rem, 0)
	print(days)
for _ in range(int(input())):
	case()


for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	m = (n + 1) // 2
	(d, p) = (m % g, m // g)
	r = (p - 1) * (g + b) + g if d == 0 else p * (g + b) + d
	print(max(n, r))


from math import ceil, floor
t = int(input())
while t:
	(n, g, b) = map(int, input().split())
	div = ceil(n / 2)
	total = floor(div / g)
	if div % g == 0:
		print(max(n, total * (b + g) - b))
	else:
		print(max(n, total * (b + g) + div % g))
	t = t - 1


import math
T = int(input())
for i in range(T):
	temp = input().split(' ')
	n = int(temp[0])
	g = int(temp[1])
	b = int(temp[2])
	if b <= g:
		print(n)
	else:
		half = math.ceil(n / 2)
		half = math.ceil(half / g) - 1
		if half == 0:
			print(n)
			continue
		ans = half * b + math.ceil(n / 2)
		if ans < n:
			print(n)
			continue
		print(int(ans))


import sys
inp = sys.stdin.readline
input = lambda : inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	while T:
		T -= 1
		(n, a, b) = lin()
		md = n + 1 >> 1
		t = a + b
		x = md // a - 1
		md -= x * a
		ans = x * t + (t + (md - a) if md > a else md)
		print(max(ans, n))
main()


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	half = (n - 1) // 2 + 1
	ans = (g + b) * (half // g) - b
	if half % g != 0:
		ans += b + half % g
	print(max(ans, n))


import math

def solve(n, g, b):
	if n // g == 0:
		return n
	gd = math.ceil(n / 2)
	if gd % g != 0:
		x = gd // g
		if n - (x * g + x * b + (gd - x * g)) > 0:
			totaldays = x * g + x * b + (gd - x * g) + (n - (x * g + x * b + (gd - x * g)))
		else:
			totaldays = x * g + x * b + (gd - x * g)
	else:
		x = gd // g
		if n - (x * g + (x - 1) * b) > 0:
			totaldays = x * g + (x - 1) * b + (n - (x * g + (x - 1) * b))
		else:
			totaldays = x * g + (x - 1) * b
	return totaldays
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	print(solve(n, g, b))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	n1 = (n - 1) // 2 + 1
	k = (n1 - 1) // g + 1
	s = max((k - 1) * b + n1, n)
	print(s, end='\n')


for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n % 2 == 0:
		q = n // 2
	else:
		q = n // 2 + 1
	if q % g == 0:
		w = q // g
	else:
		w = q // g + 1
	if n < q + (w - 1) * b:
		print(q + (w - 1) * b)
	else:
		print(n)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	bad = n // 2
	good = n - bad
	k = good // g
	count = 0
	m = good % g
	res = 0
	if n <= min(g, b):
		print(n)
	else:
		if m != 0:
			count = k * (g + b) + m
			res = k
		else:
			count = k * g + b * (k - 1)
			res = k - 1
		if bad <= res * b:
			print(count)
		else:
			count += bad - res * b
			print(count)


import math
t = int(input())
for _ in range(t):
	(n, g, b) = list(map(int, input().split()))
	if g >= b:
		print(n)
	else:
		res = 0
		greq = math.ceil(n / 2)
		goc = greq // g
		res += (g + b) * goc - b
		left = greq - g * goc
		if left > 0:
			res += b + left
		if res < n:
			res = n
		print(res)


import math

def check(days, n, g, b, req):
	good = g * (days // (g + b)) + min(g, days % (g + b))
	if good >= req and days >= n:
		return True
	return False

def solve(n, g, b, ans):
	req = int(math.ceil(n / 2))
	low = 1
	high = 10 ** 20
	min_val = float('inf')
	while low <= high:
		mid = low + (high - low) // 2
		if check(mid, n, g, b, req):
			min_val = min(min_val, mid)
			high = mid - 1
		else:
			low = mid + 1
	ans.append(min_val)

def main():
	ans = []
	t = int(input())
	for i in range(t):
		(n, g, b) = map(int, input().split())
		solve(n, g, b, ans)
	for i in ans:
		print(i)
main()


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	half = math.ceil(n / 2)
	if g >= half:
		print(n)
	else:
		d = half // g * (g + b) - b
		if half % g != 0:
			d = half // g * (g + b) + half % g
		if d >= n:
			print(d)
		else:
			foo = n - half - (d - half)
			print(d + foo)


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	gr = n // 2 + n % 2
	days = gr + (math.ceil(gr / g) - 1) * b
	rem = n - gr
	rem -= (math.ceil(gr / g) - 1) * b
	if rem > 0:
		days += rem
	print(days)


I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
t = I()
for _ in range(t):
	(n, g, b) = ID()
	q = (n + 1) // 2
	a = q // g * (g + b) + q % g
	if q % g == 0:
		a -= b
	if a < n:
		print(n)
	else:
		print(a)


from sys import stdin
import math
t = int(stdin.readline())
for _ in range(t):
	(n, g, b) = map(int, stdin.readline().rstrip().split(' '))
	r = math.ceil(n / 2)
	if r % g == 0:
		c = r // g - 1
	else:
		c = r // g
	answer = 0
	answer += c * (g + b)
	if c * g < r:
		answer += r - c * g
	if answer < n:
		answer = n
	print(answer)


n = int(input())
for _ in range(n):
	(s, g, b) = map(int, input().split())
	res = (s // 2 + s % 2) // g
	ans = 0
	if (s // 2 + s % 2) % g != 0:
		ans = res * (g + b) + (s // 2 + s % 2) % g
	else:
		ans = res * (g + b) - b
	print(max(ans, s))


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split(' '))
	target = (n + 1) // 2
	cycle = (target + g - 1) // g - 1
	d = cycle * (g + b) + target - g * cycle
	if cycle * b < n - target:
		d += n - target - cycle * b
	print(d)


from math import ceil
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	seg_b = ceil(ceil(n / 2) / g) - 1
	print(ceil(n / 2) + seg_b * b + max(0, n - ceil(n / 2) - seg_b * b))


import math

def main():
	t = int(input())
	while t > 0:
		(l, g, b) = [int(x) for x in input().split()]
		half = int((l + 1) / 2)
		tfbp = (int(half / g) - 1) * b
		if int(half % g) > 0:
			tfbp += b
		if tfbp + half < l:
			tfbp += l - (tfbp + half)
		ans = half + tfbp
		print(ans)
		t -= 1
main()


from math import factorial, ceil
from collections import Counter
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
inputI = int(input())
mod = 1000000007
INF = float('inf')

def main():
	N = inputI
	for _ in range(N):
		(n, g, b) = RL()
		need = ceil(n / 2)
		t = ceil(need / g)
		res = t * g + (t - 1) * b - (t * g - need)
		print(max(res, n))
main()


t = int(input())
for tt in range(0, t):
	inp = input().split(' ')
	n = int(inp[0])
	g = int(inp[1])
	b = int(inp[2])
	r = 0
	if n & 1:
		r = n // 2 + 1
	else:
		r = n // 2
	if r <= g:
		print(n)
	else:
		f = r // g
		m = r % g
		bad = (f - 1) * b
		if m != 0:
			bad += b
		total = f * g + bad + m
		bal = n - r
		if bal <= bad:
			print(total)
		else:
			print(total + (bal - bad))


def fix_highway(length, good_days, bad_days):
	allowance = length // 2
	days = 0
	while length > 0:
		if length - good_days <= 0:
			return days + length
		else:
			days += good_days
			length -= good_days
		if allowance == 0:
			temp = length // good_days
			temp += 1 if length % good_days != 0 else 0
			return days + temp * bad_days + length
		if length - bad_days <= 0:
			if length <= allowance:
				return days + length
			else:
				days += bad_days
				length -= allowance
				allowance = 0
		elif bad_days <= allowance:
			days += bad_days
			length -= bad_days
			allowance -= bad_days
		else:
			days += bad_days
			length -= allowance
			allowance = 0
	return days
useless = int(input())
for i in range(useless):
	(n, g, b) = (int(i) for i in input().split())
	print(fix_highway(n, g, b))


for _ in [0] * int(input()):
	(n, g, b) = map(int, input().split())
	nn = (n + 1) // 2
	print(max(nn + (nn - 1) // g * b, n))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if b <= g:
		print(n)
	else:
		left = n - 1
		right = 10 ** 30
		while right - left > 1:
			m = (left + right) // 2
			q = m // (g + b)
			r = m % (g + b)
			r = min(g, r)
			god = q * g + r
			if god >= (n + 1) // 2:
				right = m
			else:
				left = m
		print(left + 1)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	total_days = n
	sprint = g + b
	req_sprint = n // sprint
	extra_sprint = n % sprint
	extra_goods = min(g, extra_sprint)
	curr_goods = req_sprint * g + extra_goods
	if curr_goods < math.ceil(n / 2):
		req_goods = math.ceil(n / 2) - curr_goods
		if extra_sprint > g:
			total_days += sprint - extra_sprint
		else:
			req_goods -= g - extra_sprint
			total_days += sprint - extra_sprint
		whole_sprint = req_goods // g
		rem_sprint = req_goods % g
		total_days += sprint * whole_sprint
		if rem_sprint == 0:
			total_days -= b
		total_days += rem_sprint
	print(total_days)


for i in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	n1 = n
	n = (n + 1) // 2
	k = n // g
	if n % g:
		print(max(n1, k * (g + b) + n % g))
	else:
		print(max(n1, g * k + b * (k - 1)))


import sys
import math
import itertools
import functools
import collections
import operator

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

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = ii()
for _ in range(t):
	(n, g, b) = mi()
	if math.ceil(n / 2) <= g or g >= b:
		print(n)
	else:
		ans = (math.ceil(math.ceil(n / 2) / g) - 1) * b
		print(max(n, ans + math.ceil(n / 2)))


t = int(input())
for _ in range(t):
	(n, g, b) = [int(x) for x in input().split()]
	p = n // 2 + n % 2
	y = 0
	if p % g == 0:
		x = (g + b) * (p // g) - b
		y = max(0, p // g - 1)
		if y * b >= n - p:
			print(x)
		else:
			print(x + (n - p - y * b))
	else:
		x = (g + b) * (p // g) + p % g
		y = p // g
		if y * b >= n - p:
			print(x)
		else:
			print(x + (n - p - y * b))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(x, y, z) = map(int, input().split())
	hit = -(-x // 2)
	(lk, lm) = divmod(hit, y)
	if lm:
		r = lk * (y + z) + lm
	else:
		r = (lk - 1) * (y + z) + y
	if r < x:
		print(x)
	else:
		print(r)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	gn = (n + 1) // 2
	c = gn % g
	if c > 0:
		print(max(n, (gn - c) // g * (g + b) + c))
	else:
		print(max(n, (gn - c) // g * (g + b) - b))


import math
q = int(input())
for _ in range(q):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		need_good = math.ceil(n / 2)
		full_good = need_good // g
		good = full_good * g
		rem = need_good % g
		good += rem
		if rem > 0:
			bad = full_good * b
		elif rem == 0:
			bad = (full_good - 1) * b
		n -= good
		n -= bad
		ans = bad + good
		if n > 0:
			ans += n
		print(ans)


import sys
T = int(input())

def solve(n, g, b):
	m = (n + 1) // 2
	ans = (m - 1) // g * (g + b) + (m % g if m % g else g)
	return max(ans, n)

def solve2(n, g, b):
	required = n // 2 if n % 2 == 0 else n // 2 + 1
	result = 0
	(good, bad) = (0, 0)
	if n > g + b:
		num_cycles = n // (g + b)
		good += num_cycles * g
		bad += num_cycles * b
		result += good + bad
	n = n - result
	if n > g:
		good += g
		result += g
		n -= g
	else:
		left = g - n
		good += n
		result += n
		n = 0
		if required <= good:
			return result
		elif required - good <= left:
			return result + required - good
		else:
			good += left
			result += left + b
	if n > 0:
		assert b >= n
		left = b - n
		bad += n
		result += n
		if required <= good:
			return result
		else:
			result += left
	left = required - good
	num_cycles = max(left // g - 2, 0)
	result += num_cycles * (b + g)
	left = left - g * num_cycles
	while left > 0:
		if left > g:
			left -= g
			result += b + g
		else:
			result += left
			left = 0
	return result
for n in range(1, 10):
	for g in range(1, 10):
		for b in range(1, 10):
			s1 = solve(n, g, b)
			s2 = solve2(n, g, b)
			if s1 != s2:
				print(n, g, b)
for _ in range(T):
	(n, g, b) = map(int, input().split())
	print(solve2(n, g, b))


import math

def callAlgo(temparr):
	n = temparr[0]
	g = temparr[1]
	b = temparr[2]
	t1 = math.floor(n / (g + b))
	t2 = math.floor(math.ceil(n / 2) / g)
	if math.ceil(n / 2) % g == 0:
		t2 -= 1
		goodCondition = g
	else:
		goodCondition = math.ceil(n / 2) % g
	totalCondition = n % (g + b)
	if t1 > t2:
		print(t1 * (g + b) + totalCondition)
	elif t1 < t2:
		print(t2 * (g + b) + goodCondition)
	else:
		print(t1 * (g + b) + max(goodCondition, totalCondition))
n = int(input())
for case in range(n):
	line = input()
	temparr = list(map(int, line.split(' ')))
	callAlgo(temparr)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		needed_days = n // 2 + n % 2
		week = g + b
		if needed_days % g:
			no_of_weeks = needed_days // g
			no_of_weeks *= week
			no_of_weeks += needed_days % g
		else:
			no_of_weeks = needed_days // g
			no_of_weeks *= week
			no_of_weeks -= b
		print(max(n, no_of_weeks))


(t, l) = (int(input()), [])
for i in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b or g >= n:
		l.append(str(n))
	else:
		q = (n + 1) // 2
		if q % g == 0:
			r = (q // g - 1) * (g + b) + g
			if r >= n:
				l.append(str(r))
			else:
				l.append(str(n))
		else:
			r = q // g * (g + b) + q % g
			if r >= n:
				l.append(str(r))
			else:
				l.append(str(n))
print('\n'.join(l))


def ceil(x, y=1):
	return int(-(-x // y))
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	necesariosg = ceil(n, 2)
	gc = necesariosg // g
	if necesariosg - gc * g:
		ultimoG = gc * (g + b) + (necesariosg - gc * g)
	else:
		ultimoG = gc * (g + b) - b
	print(ultimoG) if ultimoG >= n else print(n)


t = int(input())
for x in range(t):
	(n, g, b) = map(int, input().split())
	m = n * 1
	n = (n + 1) // 2
	if n % g == 0:
		g2 = n // g * (g + b) - b
	else:
		g2 = n // g * (g + b) + n % g
	if g2 >= m:
		print(g2)
	else:
		print(m)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	k = n
	n = (n + 1) // 2
	c = (n + g - 1) // g
	print(max((c - 1) * b + n, k))


for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	if g >= b:
		print(n)
		continue
	ans = 0
	m = n
	n = (n + 1) // 2
	com = n // g
	if n % g != 0:
		print(max(m, com * (b + g) + n % g))
	else:
		print(max(m, com * (b + g) - b))


from sys import stdin
import math
input = stdin.readline
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	m = (n + 1) // 2
	print(max(n, (math.ceil(m / g) - 1) * (g + b) + (m - 1) % g + 1))


from collections import *
from bisect import *
from math import *
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = n // 2
	m = n
	if n % 2 == 1:
		x += 1
	if x <= g:
		print(n)
	else:
		val = g
		n -= g
		x -= g
		ans = int(ceil(x / g))
		val += ans * (g + b) - (ans * g - x)
		if val < m:
			val = m
		print(val)


for _ in ' ' * int(input()):
	(a, b, c) = map(int, input().split())
	k = ((a + 1) // 2 + b - 1) // b
	s = (b - 1) * k + c * (k - 1) + (a + 1) // 2 - (b - 1) * k
	print(s + max(0, a - s))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if (n + 1) // 2 < g:
		print(n)
	else:
		n2 = (n + 1) // 2
		caca = n2 % g if n2 % g else g
		n2 -= caca
		print(max(n2 // g * (g + b) + caca, n))


def checker(n, g, b):
	ws = n // 2 + n % 2
	count1 = ws // g
	if ws % g == 0:
		count1 -= 1
	count2 = max(count1, 0)
	wb = b * count2
	return ws + wb if n <= ws + wb else n
for _ in range(int(input())):
	(N, G, B) = [int(i) for i in input().split()]
	print(checker(N, G, B))


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)
t = intput()
for _ in range(t):
	(n, g, b) = intsput()
	start = 1
	stop = 10 ** 30
	test = (start + stop + 1) // 2
	while start != stop:
		fulls = test // (g + b)
		leftover = test - (g + b) * fulls
		good = 0
		bad = 0
		if leftover <= g:
			good = leftover
		else:
			good = g
			bad = leftover - g
		aa = fulls * g + good
		bb = fulls * b + bad
		okay = aa * 2 >= n and aa + bb >= n
		if okay:
			stop = test
		else:
			start = test + 1
		test = (start + stop) // 2
	print(test)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split(' '))
	min_good_days = math.ceil(n / 2)
	if min_good_days / g <= 1:
		print(n)
		continue
	bad_days = (math.ceil(min_good_days / g) - 1) * b
	res = min_good_days + bad_days
	if res - n < 0:
		res += n - res
	print(res)


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
		continue
	well = math.ceil(n / 2)
	res = math.floor(well / g) * (g + b)
	if well % g == 0:
		res = res - b
	else:
		res = res + well % g
	print(max(n, res))


from math import ceil, floor
for i in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g > n:
		print(n)
	else:
		(mid2, s) = (ceil(ceil(n / 2) / g), g + b)
		ans = mid2 * s
		ans -= b
		if ans < n:
			ans += n - ans
		else:
			ans -= g
			if ceil(n / 2) % g:
				ans += ceil(n / 2) % g
			else:
				ans += g
		print(max(ans, n))


import sys
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
		continue
	p = (n + 1) // 2
	q = p // g
	if p % g != 0:
		a = q * (g + b) + p % g
	else:
		a = q * (g + b) - b
	print(max(a, n))


def main(nums):
	lst = []
	for i in nums:
		lst.append(i)
	import math
	half = math.ceil(lst[0] / 2)
	cycles = math.ceil(half / lst[1])
	t = (cycles - 1) * lst[1] + (cycles - 1) * lst[2]
	r = half % lst[1]
	total = t + r if r > 0 else t + lst[1]
	return max(lst[0], total)
a = int(input())
for i in range(a):
	inp = map(int, input().split())
	print(main(inp))


t = int(input())
while t > 0:
	t = t - 1
	(n, g, b) = map(int, input().split())
	p = (n + 1) // 2
	ans = p // g * (g + b)
	if p % g == 0:
		ans = ans - b
	else:
		ans = ans + p % g
	print(max(n, ans))


import math
t = input()
t = int(t)
while t:
	t -= 1
	(n, g, b) = input().split()
	n = int(n)
	g = int(g)
	b = int(b)
	if g >= n:
		print(n)
	else:
		gd = math.ceil(n / 2)
		oc = math.ceil(gd / g)
		bd = (oc - 1) * b
		if bd == 0:
			bd = n - gd
		total = gd + bd
		if total < n:
			total = n
		print(total)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(n, g, b) = li()
	halfgood = math.ceil(n / 2)
	remhalf = n - halfgood
	totg = halfgood // g
	halfgood -= g * totg
	remhalf -= b * totg - (b if not halfgood else 0)
	remhalf = max(0, remhalf)
	tot = totg * (g + b) - (b if not halfgood else 0)
	tot += halfgood + remhalf
	print(tot)


t = int(input())
for i in range(t):
	(n, ho, pl) = map(int, input().split())
	days = n // 2 + n % 2
	seasons = days // ho + int(days % ho > 0)
	if (seasons - 1) * pl <= n - days:
		print(n)
	else:
		print((seasons - 1) * pl + days)


from math import ceil, floor, log, sqrt, factorial
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	req = (n + 1) // 2
	p = ceil(req / g)
	ans = (p - 1) * b + req
	if ans > n:
		print(ans)
	else:
		print(n)


from math import ceil as c
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = c(n / 2)
	if x <= g or (g == 1 and b == 1):
		print(n)
	else:
		f = x // g
		if f * g == x:
			f -= 1
		t = x + b * f
		if t < n:
			t = n
		print(t)


import math
n = int(input())
no_of_lines = n
lines = ''
for i in range(no_of_lines):
	lines += input() + '\n'
templines = lines.split('\n')
temparr = [list(map(int, templines[i].split(' '))) for i in range(n)]
for i in range(no_of_lines):
	n = temparr[i][0]
	g = temparr[i][1]
	b = temparr[i][2]
	t1 = math.floor(n / (g + b))
	t2 = math.floor(math.ceil(n / 2) / g)
	if math.ceil(n / 2) % g == 0:
		t2 -= 1
		goodCondition = g
	else:
		goodCondition = math.ceil(n / 2) % g
	totalCondition = n % (g + b)
	if t1 > t2:
		print(t1 * (g + b) + totalCondition)
	elif t1 < t2:
		print(t2 * (g + b) + goodCondition)
	else:
		print(t1 * (g + b) + max(goodCondition, totalCondition))


import math
from sys import stdin
for _ in range(int(input())):
	(n, g, b) = map(int, stdin.readline().rstrip().split(' '))
	if g >= b or n == 1:
		print(n)
	else:
		g_d = math.ceil(n / (2 * g))
		if g_d == 1:
			print(n)
		elif b * (g_d - 1) < math.ceil(n / 2):
			print(n)
		else:
			print(math.ceil(n / 2) + (g_d - 1) * b)


t = int(input())
import math
for _ in range(t):
	(n, g, b) = list(map(int, input().split()))
	total = 0
	if g >= b:
		total = n
	else:
		x = math.ceil(math.ceil(n / 2) / g)
		total = math.ceil(n / 2) + (x - 1) * b
		if total < n:
			total = n
	print(total)


import math
for i in range(int(input())):
	c = 0
	(n, g, b) = map(int, input().split())
	x = int(math.ceil(n / 2))
	if g >= x:
		print(n)
	else:
		y = math.ceil(x / g)
		z = x // g
		r = x % g
		if y == z:
			print(max(z * g + (z - 1) * b, n))
		else:
			print(max(z * g + z * b + r, n))


import math

def nationalProject(A, g, b):
	reqBD = math.ceil(A // 2 / b) * (g + b)
	G = math.ceil(A // 2 / b) * g
	if G >= math.ceil(A / 2):
		return A
	else:
		if (math.ceil(A / 2) - G) % g == 0:
			return reqBD + (math.ceil(A / 2) - G) // g * (g + b) - b
		return reqBD + (math.ceil(A / 2) - G) // g * (g + b) + (math.ceil(A / 2) - G) % g
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	print(nationalProject(n, g, b))


from math import ceil
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	goodNeeded = ceil(n / 2)
	if goodNeeded <= g:
		print(n)
		continue
	ans = g
	goodNeeded -= g
	minCycles = ceil(goodNeeded / g)
	ans += minCycles * (b + g)
	ans -= minCycles * g - goodNeeded
	ans = max(ans, n)
	print(ans)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	h = n
	n = -(-n // 2)
	n -= g
	if n <= 0:
		print(h)
	else:
		ans = g
		u = n // g
		n -= u * g
		ans += u * (g + b)
		if n > 0:
			ans += b
			ans += n
		if ans <= h:
			print(h)
		else:
			print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, g, b) = LI()
		if g >= b:
			rr.append(n)
		else:
			t = (n - 1) // (g * 2)
			a = (b - g) * t
			r = t * (g + b)
			u = n - t * g * 2
			u -= min(u // 2, a)
			r += u
			rr.append(r)
	return JA(rr, '\n')
print(main())


import math
for _ in range(int(input())):
	(n, a, b) = map(int, input().split())
	x = (n + 1) // 2
	ans = x // a * (a + b)
	if x % a == 0:
		ans -= b
	else:
		ans += x % a
	print(max(n, ans))


import sys
import math
input = sys.stdin.buffer.readline

def I():
	return list(map(int, input().split()))

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	(n, g, b) = I()
	k = math.ceil(n / 2)
	togetgood = math.ceil(k / g) * (g + b)
	extragood = togetgood // (g + b) * g - k
	togetgood -= extragood + b
	print(max(n, togetgood))


def do(n, g, b):
	needG = n // 2 + (n & 1)
	tot = (g + b) * (needG // g)
	if needG % g:
		return max(tot + needG % g, n)
	return max(tot - b, n)
for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	print(do(n, g, b))


import math
for x in range(int(input())):
	(n, h, m) = list(map(int, input().split()))
	if h >= m:
		print((h + m) * (n // (h + m)) + n % (h + m))
	else:
		k = math.ceil(n / 2)
		if k % h == 0:
			print(h * (k // h) + max(n - k, (k // h - 1) * m))
		else:
			print(h * (k // h) + max(k // h * m, n - k) + k % h)


import sys
from math import log2, floor, ceil
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	(n, a, b) = Ri()
	if n <= a:
		print(n)
	else:
		half = ceil(n / 2)
		noturns = half // a
		rem = half % a
		n = n - half
		if rem != 0:
			dayz = a * noturns + b * noturns + rem
			n -= b * noturns
		else:
			dayz = a * noturns + b * (noturns - 1) + rem
			n -= b * (noturns - 1)
		if n <= 0:
			print(dayz)
		else:
			print(dayz + n)


import sys
from math import ceil
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
for _ in range(cin()):
	(n, g, b) = mi()
	print(max(n, g * (ceil(n / 2) // g) + (ceil(ceil(n / 2) / g) - 1) * b + ceil(n / 2) % g))


q = int(input())
for i in range(q):
	(n, g, b) = list(map(int, input().split(' ')))
	if n <= g:
		print(n)
	else:
		if n % 2 == 0:
			d = n // 2
		else:
			d = n // 2 + 1
		days = 0
		if g == b:
			print(n)
		else:
			if d % g == 0:
				rem = d // g
			else:
				rem = d // g + 1
			if b * (rem - 1) >= d:
				days = days + b * (rem - 1) + d
				print(days)
			else:
				days = d
				print(n)


T = int(input())
while T > 0:
	(n, g, b) = map(int, input().split())
	need = n // 2
	if n % 2 == 1:
		need += 1
	x = need // g
	if need % g != 0:
		x += 1
	left = need - g * (x - 1)
	res = (g + b) * (x - 1) + left
	print(max(res, n))
	T -= 1


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	m = (n + 1) // 2
	m1 = n - m
	d = 0
	k = m // g
	if m % g != 0:
		d = (g + b) * k + m % g
	else:
		d = g * k + (k - 1) * b
	n = n - d
	if n > 0:
		d += n
	print(d)


for case in range(int(input())):
	(n, g, b) = [int(x) for x in input().split()]
	k = n // 2
	if n % 2 == 1:
		k += 1
	days = 0
	rem = n
	if k <= g:
		days = n
	else:
		l = k // g
		days += g * l + b * (l - 1)
		k -= g * l
		if k > 0:
			days += b
			days += k
		if days < n:
			days = n
	print(days)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	req = math.ceil(n / 2)
	if g >= req:
		print(n)
	else:
		ans = 0
		if req % g == 0:
			ans += (req // g - 1) * (g + b) + g
		else:
			ans += req // g * (g + b) + req % g
		if ans < n:
			ans += n - ans
		print(ans)


q = int(input())
import math
for _ in range(q):
	(n, g, b) = map(int, input().split())
	rg = math.ceil(n / 2)
	rb = n - rg
	res = 0
	needcycle = math.ceil(rg / g)
	rg = rg - g * (needcycle - 1)
	rb = max(0, rb - b * (needcycle - 1))
	res = (g + b) * (needcycle - 1) + (rg + rb)
	print(res)


from sys import stdin
input = stdin.readline
import math
for xoxo in range(1):
	for _ in range(int(input())):
		(n, g, b) = map(int, input().split())
		N = n
		if g >= b or n <= g:
			print(n)
		else:
			n = math.ceil(n / 2)
			if n <= g:
				print(N)
				continue
			k = n // g
			if n % g == 0:
				ans = k * (g + b)
				ans -= b
				bad = (k - 1) * b
				ans += max(N - n - bad, 0)
			else:
				ans = k * (g + b)
				ans += n % g
				bad = k * b
				ans += max(N - n - bad, 0)
			print(ans)


def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1
t = int(input())
for _ in range(t):
	(n, g, b) = list(map(int, input().split()))
	p = ceil(n, 2)
	l = g + b
	q = n - p
	x = p // g
	a = p % g
	c = x * l + a
	if p % g != 0:
		if q <= x * b:
			print(c)
		else:
			print(c + (q - x * b))
	elif q <= (x - 1) * b:
		print(c - b)
	else:
		print(c - b + (q - (x - 1) * b))


from math import ceil

def main():
	for _ in range(int(input())):
		(n, g, b) = map(int, input().split())
		need = ceil(n / 2)
		if need % g == 0:
			d = need // g * (g + b) - b
		else:
			d = need // g * (g + b) + need % g
		print(max(d, n))
main()


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	t = ceil(n / 2)
	if g >= n:
		print(n)
		continue
	elif g >= t and g + b >= n:
		print(n)
		continue
	elif g >= b:
		print(n)
	else:
		count = t + b * ((t - 1) // g)
		print(max(n, count))


import collections, heapq

def main():
	T = int(input().strip())
	for _ in range(T):
		(n, a, b) = [int(x) for x in input().strip().split(' ')]
		tmp = ((n + 1) // 2 - 1) // a
		bDay = tmp * b
		if (n + 1) // 2 + bDay < n:
			print(n)
		else:
			print((n + 1) // 2 + bDay)
main()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
from math import ceil, floor, log, sqrt, factorial
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		(n, g, b) = mi()
		m = ceil(n / 2)
		x = ceil(m / g)
		if x == 0:
			ans = m
		else:
			ans = (x - 1) * b + m
		if ans >= n:
			print(ans)
		else:
			print(ans + n - ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (N, G, B) in Query:
	border = (N + 1) // 2
	p = border // G
	q = border % G
	if q == 0:
		p -= 1
		q += G
	ans = p * (G + B) + q
	print(max(ans, N))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	a = (n + 1) // 2
	tot = a // g * (g + b)
	if a % g == 0:
		tot -= b
	else:
		tot += a % g
	print(max(n, tot))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = (n + 1) // 2 // g
	y = x * (g + b) + (n + 1) // 2 % g
	if not (n + 1) // 2 % g:
		y -= b
	print(y + max(0, n - y))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	req = ceil(n / 2)
	sm = g + b
	div = int(req / g)
	used = sm * div - b
	req -= div * g
	if req == 0:
		print(max(used, n))
	else:
		used += b
		print(max(used + req, n))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	half = math.ceil(n / 2)
	days = 0
	rem = 0
	nm = 0
	req = 0
	if n <= g:
		print(n)
	else:
		req = half // g
		rem = half % g
		days = req * g + rem + (math.ceil(half / g) - 1) * b
		if days < n:
			print(n)
		else:
			print(days)


def min_days(n, g, d):
	T = g + d
	m = (n + 1) // 2
	cycle = m // g
	res = m % g
	if res == 0:
		ans = (cycle - 1) * T + g
		ans = max(ans, n)
		return ans
	ans = cycle * T + res
	ans = max(ans, n)
	return ans
t = int(input())
for _ in range(t):
	(n, g, d) = [int(s) for s in input().split(' ')]
	ans = min_days(n, g, d)
	print(ans)


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	(n, g, b) = Read.list_int()
	pol = math.ceil(n / 2)
	t = math.ceil(pol / g)
	kal = pol - (t - 1) * g
	res = (t - 1) * (b + g) + kal
	if res < n:
		res = n
	print(res)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


from math import ceil
T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split())
	t = ceil(n / 2)
	t1 = t // g
	if t % g:
		ans = t1 * (g + b) + t % g
		if ans >= n:
			pass
		elif ans < n:
			ans = t1 * (g + b) + t % g
			ans = ans + n - t - t1 * b
	else:
		ans = t1 * (g + b) - b
		if ans >= n:
			pass
		elif ans < n:
			ans = ans + n - t - (t1 - 1) * b
	print(ans)


mod = 10 ** 9 + 7
import math
from bisect import bisect_left
from collections import Counter
from itertools import combinations

def ain():
	return map(int, input().split())

def fain():
	return map(float, input().split())

def f(x, y):
	return (x | y) - y
for _ in range(int(input())):
	(n, g, d) = ain()
	req = n // 2 + n % 2
	req_d = req // g
	if req % g == 0:
		val = (g + d) * (req_d - 1) + g
	else:
		val = (g + d) * req_d + req % g
	print(max(n, val))


import math
whatever = int(input())
for i in range(whatever):
	test_case = input().split()
	n = int(test_case[0])
	g = int(test_case[1])
	b = int(test_case[2])
	if g > n:
		print(n)
		continue
	total_days = 0
	ngood = math.ceil(n / 2)
	check = False
	if ngood % g == 0:
		check = True
	divup = math.ceil(ngood / g)
	divdown = ngood // g
	if check:
		total_days += (divdown - 1) * b
		total_days += divdown * g
		ngood -= divdown * g
	else:
		total_days += divdown * b
		total_days += divdown * g
		ngood -= divdown * g
	total_days += ngood
	if total_days < n:
		print(n)
		continue
	print(total_days)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import math
mod = 100000007

def isl(y):
	if y % 400 == 0:
		return True
	elif y % 4 == 0 and y % 100 != 0:
		return True
	return False

def day(d, m, y):
	t = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4]
	y -= m < 3
	return (y + int(y / 4) - int(y / 100) + int(y / 400) + t[m - 1] + d) % 7

def main():
	for i in range(ii()):
		(n, g, b) = mi()
		if g >= n:
			print(n)
			continue
		c = math.ceil(n / 2)
		d = math.ceil(c / g)
		e = d - 1
		ans = d * g + e * b
		ans -= d * g - c
		print(int(max(ans, n)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= b or min(g, b) >= n:
		print(n)
	else:
		half_high = ceil(n / 2)
		times = ceil(half_high / g) - 1
		T = times * (b + g)
		last = n - times * (b + g)
		res = half_high % g
		if res == 0:
			res = g
		if last < res:
			ans = T + res
		else:
			ans = last + times * (b + g)
		print(ans)


t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	z = (a + 1) // 2
	ans = z // b * (b + c)
	if z % b == 0:
		ans -= c
	else:
		ans += z % b
	print(max(a, ans))
	t -= 1


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	bad = n // 2
	good = n - bad
	low = 1
	high = 10 ** 18
	while low < high:
		mid = (low + high) // 2
		(goo, ba) = (mid // (g + b) * g, mid // (g + b) * b)
		mi = mid
		mi -= goo + ba
		left = min(mi, g)
		goo += left
		ba += mi - left
		if goo + min(bad, ba) >= n:
			high = mid
		else:
			low = mid + 1
	print(low)


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	k = n // 2 + n % 2
	x = k // g
	if x == 0:
		print(n)
	else:
		y = x * g + (x - 1) * b
		if k % g != 0:
			y += k - x * g + b
		y = max(n, y)
		print(y)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	c = 0
	k = math.ceil(n / 2)
	a = math.ceil(k / g)
	c = (a - 1) * b + k
	print(max(c, n))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	org = n
	if n <= g:
		ans = n
	else:
		construct = (n + 1) // 2
		ans = construct // g * (g + b) + construct % g
		if construct % g == 0:
			ans -= b
	print(max(org, ans))


import math
t = int(input())
m = 0
while m < t:
	(n, g, b) = map(int, input().split())
	gn = math.ceil(n / 2)
	if gn % g:
		tt = gn // g * (g + b) + gn % g
	else:
		tt = gn // g * (g + b) - b
	print(int(max(tt, n)))
	m = m + 1


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		half = n // 2
		turn1 = (half + b - 1) // b
		if turn1 * g + half >= n:
			print(n)
			continue
		rem = n - half - g * turn1
		turn2 = rem // g
		if rem % g == 0:
			print((turn1 + turn2 - 1) * (g + b) + g)
		else:
			print((turn1 + turn2) * (g + b) + rem % g)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
testcases = int(input())
for j in range(testcases):
	(n, g, b) = map(int, input().split())
	out = 0
	half = math.ceil(n / 2)
	if half <= g:
		out += n
	elif half > g:
		val1 = half % g
		val2 = g * (half // g)
		val3 = b * (half // g - 1)
		out += val2 + val3
		ext = max(0, n - half - val3)
		if val1 >= 1:
			out += b + val1
			ext = max(0, ext - b)
		out += ext
	print(out)


import collections
for t in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	d = n // 2 + n % 2
	(full, inc) = divmod(d, g)
	ans = (g + b) * (full - 1, full)[inc > 0] + (g, inc)[inc > 0]
	print(ans if ans >= n else n)


def solve(n, g, b):
	m = n // 2 + n % 2
	if m % g == 0:
		ans = (m // g - 1) * (g + b) + g
	else:
		ans = m // g * (g + b) + m % g
	print(max(ans, n))

def main():
	tc = int(input())
	for _ in range(tc):
		(n, g, b) = [int(x) for x in input().split()]
		solve(n, g, b)
main()


import math
t = int(input())
for i in range(0, t):
	(n, g, b) = [int(j) for j in input().split()]
	if n % 2 == 0:
		if n // 2 <= g:
			print(n)
		else:
			nd = math.ceil(n // 2 / g)
			ngd = (nd - 1) * g
			ngd = ngd + (n // 2 - ngd)
			bd = (nd - 1) * b
			if bd < n // 2:
				bd = bd + n // 2 - bd
			print(ngd + bd)
	elif n // 2 + 1 <= g:
		print(n)
	else:
		nd = math.ceil((n + 1) // 2 / g)
		ngd = (nd - 1) * g + (n // 2 + 1 - (nd - 1) * g)
		na = nd - 1
		nbd = na * b
		if nbd < (n - 1) // 2:
			nbd = nbd + (n - 1) // 2 - nbd
		print(ngd + nbd)


from math import ceil
T = int(input())
answer = ''
for t in range(T):
	(n, g, b) = list(map(int, input().split(' ')))
	if n <= g:
		answer += str(n) + '\n'
		continue
	ost = n - g
	if ost <= n // 2:
		answer += str(n) + '\n'
		continue
	result = g + b
	nn = n
	n -= n // 2
	n -= g
	need = ceil(n / g)
	result += need * g + (need - 1) * b
	n -= need * g
	if n < 0:
		result += n
	if result < nn:
		result = nn
	answer += str(int(result)) + '\n'
print(answer)


from math import ceil
for _ in range(int(input())):
	(h, g, b) = map(int, input().split())
	n = ceil(h / 2)
	per = g + b
	tam = n // g
	res = (g + b) * tam
	kal = n - g * tam
	if tam > 0:
		if kal > 0:
			ans = res + kal
		else:
			ans = res - b
	else:
		ans = h
	print(max(ans, h))


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	half = int(math.ceil(n / 2))
	d = half // g
	d1 = d * g + (d - 1) * b
	if half % g:
		d1 += half % g + b
	d1 += max(0, n - d1)
	print(d1)


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split(' '))
	res = 0
	if g >= b:
		res = n
	else:
		(_1, _2) = divmod(n, g * 2)
		if _2 == 0:
			_1 -= 1
			_2 += g * 2
		_3 = (b - g) * _1
		_4 = min(_2 // 2, _3)
		res = _1 * (g + b) + _2 - _4
	print(res)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	(n, g, b) = I()
	a = g + b
	(lo, hi) = (0, INF)
	while lo < hi:
		mid = (lo + hi) // 2
		k = mid // a
		r = mid % a
		good = g * k
		bad = b * k
		if r <= g:
			good += r
		else:
			good += g
			bad += r - g
		if good >= ceil(n / 2) and good + bad >= n:
			hi = mid
		else:
			lo = mid + 1
	print(lo)


n = int(input())
for fwefewi in range(n):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		goal = (n + 1) // 2
		wyn = (g + b) * (goal // g)
		wyn -= b
		if goal - g * (goal // g) == 0:
			print(max(n, wyn))
		else:
			wyn += b
			wyn += goal - g * (goal // g)
			print(max(wyn, n))


for t in range(int(input())):
	(n, g, b) = [int(i) for i in input().split()]
	d = (n + 1) // 2 // g
	m = (n + 1) // 2 % g
	if m == 0:
		d -= 1
		m += g
	print(max(n, d * (g + b) + m))


from sys import stdin, stdout
input = stdin.readline

def main():
	q = int(input())
	for i in range(q):
		(n, g, b) = map(int, input().split())
		num = (n + 1) // 2
		temp = (num - 1) // g
		print(max(n, temp * (g + b) + num - temp * g))
main()


import math
T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split())
	ng = math.ceil(n / 2)
	nb = n - ng
	sg = math.ceil(ng / g)
	bd = (sg - 1) * b
	print(ng + bd + max(0, nb - bd))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
		continue
	cnt = (n + 1) // 2
	(lap, rem) = divmod(cnt, g)
	if rem == 0:
		ans = (lap - 1) * (g + b) + g
	else:
		ans = lap * (g + b) + rem
	(lap, rem) = divmod(n - cnt, b)
	if rem == 0:
		ans = max(lap * (g + b), ans)
	else:
		ans = max(lap * (g + b) + (g + rem), ans)
	(lap, rem) = divmod(n, g + b)
	g_cnt = g * lap + min(rem, g)
	if g_cnt >= (n + 1) // 2:
		ans = n
	print(ans)


from math import ceil

def main():
	t = int(input())
	for __ in range(t):
		(n, g, b) = map(int, input().split())
		g_need = (n + 1) // 2
		g_total = g_need // g * (g + b)
		if g_need % g == 0:
			g_total -= b
		else:
			g_total += g_need % g
		print(max(n, g_total))
main()


t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	k = ((n + 1) // 2 - 1) // g + 1
	r = (k - 1) * (g + b) + max(0, (n + 1) // 2 - (k - 1) * g)
	print(max(r, n))


import math

def repair_road(n, g, b):
	half = math.ceil(n / 2)
	cycles = math.ceil(half / g)
	t = (cycles - 1) * g + (cycles - 1) * b
	r = half % g
	total = t + r if r > 0 else t + g
	return max(n, total)

def solution(inp1):
	n = inp1[0]
	g = inp1[1]
	b = inp1[2]
	return repair_road(n, g, b)

def main():
	inp1 = input()
	length = int(inp1)
	for i in range(length):
		inp1 = list(map(int, input().split()))
		result = solution(inp1)
		print(result)
main()


def main():
	for _ in range(int(input())):
		(n, g, b) = map(int, input().split())
		m = (n + 1) // 2
		if m > g < b:
			n = max(n, m + b * ((m - 1) // g))
		print(n)
main()


for _ in range(int(input())):
	(nn, g, b) = [int(i) for i in input().split()]
	n = (nn + 1) // 2
	quo = n // g
	rem = n % g
	ans = 0
	hq = 0
	lq = 0
	if quo == 0:
		ans = nn
	elif rem == 0:
		ans = quo * g + (quo - 1) * b
	else:
		ans = quo * g + quo * b + rem
	print(max(ans, nn))


import math
n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	t = math.ceil(a / 2)
	d = t // b * c + t
	if t % b == 0:
		d -= c
	if d < a:
		d = a
	print(d)


from math import *
t = int(input())
for _ in range(t):
	(n, g, b) = list(map(int, input().split(' ')))
	req = int(ceil(n / 2))
	temp = req // g
	t1 = req % g
	if t1:
		temp += 1
	total = req + b * (temp - 1)
	if total < n:
		total = n
	print(total)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	cay = math.ceil(math.ceil(n / 2) / g)
	print(max(cay * g + (cay - 1) * b - (cay * g - math.ceil(n / 2)), n))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = math.ceil(n / 2)
	k = need // g
	r = need % g
	ans = 0
	if r == 0:
		ans = k * g + (k - 1) * b
	else:
		ans = k * (g + b) + r
	print(max(n, ans))


import math
t = int(input())
for i2 in range(t):
	(n, g, b) = map(int, input().split())
	if math.ceil(n / 2) % g == 0:
		ans = (math.ceil(n / 2) // g - 1) * (g + b) + g
	else:
		ans = math.ceil(n / 2) // g * (g + b) + math.ceil(n / 2) - math.ceil(n / 2) // g * g
	print(max(ans, n))


import math
T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split(' '))
	goodtiles = math.ceil(n / 2)
	daysneeded = (g + b) * (goodtiles // g)
	if goodtiles % g != 0:
		print(max(n, daysneeded + goodtiles % g))
	elif goodtiles % g == 0:
		print(max(n, daysneeded - b))


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	hq = (n + 1) // 2
	lq = n - hq
	(cycle, days) = divmod(hq, g)
	ans = (g + b) * cycle - b
	if days > 0:
		ans += b
		ans += days
	if ans < n:
		print(n)
	else:
		print(ans)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	(l, h) = (0, 1 << 60)
	while l < h:
		d = (l + h) // 2
		x = d // (g + b) * g + min(g, d % (g + b))
		y = min(x, d // (g + b) * b + max(0, d % (g + b) - g))
		if x + y < n:
			l = d + 1
		else:
			h = d
	print(l)


def solve():
	(n, g, b) = [int(x) for x in input().split()]
	l = 0
	r = int(1e+30)
	while r - l > 1:
		m = (l + r) // 2
		blk = m // (g + b)
		cnt = blk * g + min(g, m % (g + b))
		if cnt >= (n + 1) // 2:
			r = m
		else:
			l = m
	print(max(r, n))
t = int(input())
for _ in range(t):
	solve()


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	(n, g, b) = get_list()
	left = n
	half = n // 2 + n % 2
	total = 0
	if half <= g:
		print(n)
	elif half > g:
		total = half
		run_of_good = half // g
		left_in_good = half % g
		if left_in_good == 0:
			total += (run_of_good - 1) * b
		else:
			total += run_of_good * b
		total += max(0, n - total)
		print(total)


import math
a = int(input())
for k in range(a):
	b = list(map(int, input().split(' ')))
	c = math.ceil(b[0] / 2)
	sum = 0
	d = b[0] - c
	e = math.ceil(c / b[1])
	f = e * b[1]
	g = math.ceil(d / b[2])
	if e <= g:
		print(b[0])
	else:
		print(c + (e - 1) * b[2])


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	days = 0
	if b > g:
		g1 = (n + 1) // 2
		i = g1 // g
		b1 = 0
		if i > 0:
			days = (i - 1) * (g + b)
			b1 = b * (i - 1)
			days += g
		if g1 % g != 0:
			if i > 0:
				days += b
				b1 += b
			days += g1 % g
		j = n - g1 - b1
		if j > 0:
			days += j
	else:
		days = n
	print(days)


import math
for _ in range(int(input())):
	(n, g, b) = tuple(map(int, input().split()))
	h = math.ceil(n / 2)
	l = math.ceil(h / g)
	cum = l * g + (l - 1) * b
	cum1 = (g + b) * (l - 1)
	if cum < n:
		print(n)
	else:
		print(max(n, cum1 + h - g * (l - 1)))


import math
import collections
import functools
import sys
import os

def solve():
	(n, g, b) = map(int, input().split())
	ans = n
	tn = (n + 1) // 2
	cnt = tn // g
	tans = 0
	if tn % g == 0:
		cnt -= 1
		tans += g
	else:
		tans += tn % g
	tans += cnt * (g + b)
	ans = max(ans, tans)
	print(ans)

def main():
	T = 1
	T = int(input())
	while T:
		solve()
		T -= 1
main()


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	t = ceil(n / 2) + b * ceil((n - 2 * g) / (2 * g))
	print(max(t, n))


n = int(input())
for i in range(n):
	s = list(map(int, input().split(' ')))
	d = (s[0] + 1) // 2
	c = d // s[1]
	if d % s[1] == 0:
		print(max(s[0], c * (s[1] + s[2]) - s[2]))
	else:
		print(max(s[0], c * (s[1] + s[2]) + d % s[1]))


import math
t = int(input())
for _p in range(t):
	(n, g, b) = map(int, input().split())
	req = math.ceil(n / 2)
	if g >= n:
		print(n)
	else:
		e = math.ceil(req / g)
		w = math.ceil(req / g) - 1
		ans = w * b + req
		if ans < n:
			ans = n
		print(ans)


from math import *
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	least = int(ceil(n / 2))
	(weeks, r) = (least // g, least % g)
	if r == 0:
		r += g
		weeks -= 1
	left = n - least - b * weeks
	ans = weeks * (g + b) + r + max(left, 0)
	print(ans)


NTC = int(input())
for _ in range(NTC):
	(n, g, b) = map(int, input().split())
	needed = (n + 1) // 2
	if needed < g:
		good_days = needed
	else:
		left = needed - g
		days = g
		whole_cycles = left // g
		days += whole_cycles * (b + g)
		left = left - whole_cycles * g
		if left > 0:
			days += b + left
		good_days = days
	print(max(good_days, n))


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	t = n
	n = math.ceil(n / 2)
	temp = n % g
	n = n // g
	if temp == 0:
		x = n * (g + b) - b
	else:
		x = n * (g + b) + temp
	print(max(t, x))


import math as m
t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	ans1 = m.ceil(n / 2)
	ans = m.ceil(ans1 / g)
	bad = b * (ans - 1)
	if bad > n - ans1:
		print(ans1 + bad)
	else:
		print(n)


import math
t = int(input())
while t > 0:
	(n, g, b) = [int(ele) for ele in input().split()]
	m = n
	n = int((n + 1) / 2)
	k = int(n / g)
	p = n % g
	if p != 0:
		ans = k * (g + b) + p
	else:
		ans = k * (g + b) - b
	if ans < m:
		ans = m
	print(ans)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	m = n
	n = int(math.ceil(n / 2))
	a = n // g
	b1 = n % g
	c = 0
	if b1 == 0:
		q = a - 1
		c = c + b * (a - 1)
		c = c + a * g
	else:
		c = c + b * a
		c = c + g * a
		c = c + b1
	if c >= m:
		print(c)
	else:
		print(m)


def main():
	t = int(input().strip())
	for _ in range(t):
		(n, g, b) = [int(s) for s in input().strip().split()]
		hi = n - n // 2
		result = max(hi + (hi - 1) // g * b, n)
		print(result)
main()


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	low = 0
	high = 10 ** 20
	ans = -1
	tot = g + b
	while low <= high:
		mid = (low + high) // 2
		now = mid // tot
		md = mid % tot
		gn = now * g
		gn += min(g, md)
		nt = now * b
		md -= g
		if md > 0:
			nt += md
		nt += gn
		if 2 * gn >= n and nt >= n:
			ans = mid
			high = mid - 1
		else:
			low = mid + 1
	print(ans)


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	(n, g, b) = nm()
	if (n // (g + b) * g + min(g, n % (g + b))) * 2 >= n:
		print(n)
		return
	s = (n + 1) // 2
	print(s + (s - 1) // g * b)
	return
T = ni()
for _ in range(T):
	solve()


for _ in range(int(input())):
	(n, g, b) = [int(k) for k in input().strip().split(' ')]
	nu = n // 2
	if n % 2 != 0:
		nu = nu + 1
	if g >= nu:
		print(n)
	else:
		fans = nu // g * (g + b) + nu % g
		if nu % g == 0:
			if fans - b < n:
				fans = n
			else:
				fans = fans - b
		if fans < n:
			fans = n
		print(fans)


t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	a = (n + 1) // 2
	per = a // g
	ost = a % g
	if ost == 0:
		per = per - 1
		ost = g
	qqq = per * (g + b) + ost
	if qqq >= n:
		print(qqq)
	else:
		print(n)


import math
t = int(input())
for _ in range(t):
	ngb = list(map(int, input().split()))
	n1 = ngb[0]
	n = math.ceil(ngb[0] / 2)
	g = ngb[1]
	b = ngb[2]
	a = math.ceil(n / g)
	if n1 > n + (a - 1) * b:
		print(n1)
	else:
		print(n + (a - 1) * b)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	k = (n + 1) // 2
	ans = k // g
	if ans * g == k:
		ans -= 1
	print(ans * (g + b) + max(k - ans * g, n - ans * (g + b)))


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	req = 0
	if n % 2:
		req = n // 2 + 1
	else:
		req = n // 2
	ans = 0
	if req % g == 0:
		if g >= b or g >= req:
			ans = n
		else:
			ans = req // g * g + (req // g - 1) * b
			ans += max(0, n - ans)
	elif g >= b or g >= req:
		ans = n
	else:
		ans = req // g * g + req // g * b
		req = req - req // g * g
		ans += min(req, g)
		ans += max(0, n - ans)
	print(ans)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	gn = (n + 1) // 2
	itr = 0
	if gn % g == 0:
		itr = gn // g
	else:
		itr = gn // g + 1
	days = gn + b * (itr - 1)
	if days >= n:
		print(days)
	else:
		print(n)


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
for _ in range(ii()):
	(n, g, b) = f()
	hf = (n + 1) // 2
	tgs = hf // g
	ans = tgs * g
	if hf % g:
		tgs += 1
		ans += hf % g
	n -= ans
	ans += (tgs - 1) * b
	n -= min((tgs - 1) * b, n)
	ans += n
	print(ans)


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	least = (n + 1) // 2
	(d, m) = divmod(least, g)
	if m == 0:
		a = (g + b) * d - b
	else:
		a = (g + b) * d + m
	print(max(n, a))


import math
I = input
for _ in range(int(I())):
	(n, g, b) = map(int, I().split())
	r = math.ceil(n / 2)
	if r <= g:
		print(n)
	else:
		hp = r // g
		days = hp * (g + b)
		if r % g == 0:
			days -= b
		elif r % g > 0:
			days += r % g
		print(max(n, days))


import math
test = int(input())
while test:
	(n, g, b) = [int(x) for x in input().split(' ')]
	if n <= g:
		print(n)
	else:
		half = int(math.ceil(n / 2))
		ttl = half
		if half % g == 0:
			ttl = ttl + b * (half // g - 1)
		else:
			ttl = ttl + b * (half // g)
		if ttl >= n:
			print(int(ttl))
		else:
			print(n)
	test -= 1


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = (n + 1) // 2
	totdys = need // g * (g + b)
	if need % g == 0:
		totdys += -b
	else:
		totdys += need % g
	print(max(n, totdys))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = n // 2 + n % 2
	ans = 0
	whole = x // g
	rem_days = x - g * whole
	repaired = 0
	if rem_days > 0:
		ans = whole * (g + b) + rem_days
	elif whole != 0:
		ans = (whole - 1) * (g + b) + g
	else:
		ans = n
	if ans < n:
		ans = n
	print(ans)


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	day = g + b
	c = math.ceil(n / 2)
	if g >= c:
		print(n)
		continue
	s = c // g
	if c % g == 0:
		print(max(n, s * day + c % g - b))
	else:
		print(max(n, s * day + c % g))


t = int(input())
while t > 0:
	t = t - 1
	(n, g, b) = map(int, input().split(' '))
	need = (n + 1) // 2
	full = need // g
	daystillhalf = 0
	if full == 0:
		daystillhalf = need
	else:
		daystillhalf = (full - 1) * (g + b) + g
		if need % g != 0:
			daystillhalf += b + (need - full * g)
	print(max(daystillhalf, n))


import math
q = int(input())
for _ in range(q):
	(n, g, b) = map(int, input().split())
	if g >= math.ceil(n / 2):
		print(n)
	else:
		x = math.ceil(n / 2)
		a = x // g
		c = x % g
		if c == 0:
			print(max(g * a + c + b * (a - 1), n))
		else:
			print(max(g * a + c + b * a, n))


t = int(input())
for qewqeq in range(t):
	(n, g, b) = map(int, input().split())
	gt = (n + 1) // 2
	if g > b or g >= gt:
		print(n)
	else:
		f = (gt + g - 1) // g
		fa = gt - g * (f - 1)
		if (b + g) * (f - 1) + fa >= n:
			print((b + g) * (f - 1) + fa)
		else:
			print((b + g) * (f - 1) + fa + (n - ((b + g) * (f - 1) + fa)))


import math
for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	if n % 2 == 0:
		t = n // 2
		if t <= g:
			print(n)
		else:
			r = math.ceil(t / g)
			if t % g == 0:
				ans = r * g + (r - 1) * b
				if ans > n:
					print(ans)
				else:
					print(n)
			else:
				ans = (r - 1) * (g + b) + t % g
				if ans > n:
					print(ans)
				else:
					print(n)
	else:
		t = n // 2 + 1
		if t <= g:
			print(n)
		else:
			r = math.ceil(t / g)
			if t % g == 0:
				ans = r * g + (r - 1) * b
				if ans > n:
					print(ans)
				else:
					print(n)
			else:
				ans = (r - 1) * (g + b) + t % g
				if ans > n:
					print(ans)
				else:
					print(n)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	bad = n // 2
	ans = 0
	q = bad // b
	r = bad - q * b
	if r == 0:
		if n > q * (g + b):
			n -= q * (g + b)
			ans += q * (g + b)
			q1 = n // g
			r1 = n - q1 * g
			if r1 == 0:
				ans += q1 * g + (q1 - 1) * b
			else:
				ans += q1 * (g + b) + r1
		else:
			ans = n
	elif n > q * (g + b) + g + r:
		n -= q * (g + b) + g + r
		ans += (q + 1) * (g + b)
		q1 = n // g
		r1 = n - q1 * g
		if r1 == 0:
			ans += q1 * g + (q1 - 1) * b
		else:
			ans += q1 * (g + b) + r1
	else:
		ans = n
	print(ans)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	good = math.ceil(n / 2)
	ans = int(good / g) * (g + b)
	if good % g > 0:
		ans += good % g
	elif good % g == 0:
		ans -= b
	print(max(n, ans))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	f = 0
	(n, g, b) = map(int, stdin.readline().split())
	m = n // 2
	if n % 2 == 1:
		m += 1
	if g < b:
		if n % (g * 2) == 0:
			print(max(n, (n // (g * 2) - 1) * (g + b) + g))
		else:
			print(max(n, n // (g * 2) * (g + b) + (m - n // (g * 2) * g)))
	else:
		print(n)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	p = 0
	if n % 2 == 0:
		a = n // 2
	else:
		a = n // 2 + 1
	if g >= n:
		print(n)
		continue
	if a % g == 0:
		y = a // g
	else:
		y = a // g + 1
	if a > g * (y - 1):
		p += (g + b) * (y - 1) + (a - g * (y - 1))
	if p >= n:
		print(p)
	else:
		print(n)


import sys, math
MOD = 998244353
for test_num in range(int(input())):
	(n, g, b) = map(int, input().split())
	gh = math.ceil(n / 2)
	bh = n - gh
	s = gh // g
	gh -= s * g
	bh -= s * b
	if gh > 0:
		ans = max(n, s * (b + g) + gh)
	else:
		ans = max(n, s * (b + g) - b)
	print(ans)


from math import ceil, sqrt, gcd

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

def si():
	return input()

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

def li():
	return list(mi())
t = ii()
while t:
	t -= 1
	(n, g, b) = mi()
	s = ceil(n / 2)
	if s <= g:
		print(n)
		continue
	s1 = s // g
	s2 = s % g
	ans = s1 * g + (s1 - 1) * b
	if s2 != 0:
		ans += b
		ans += s2
	print(max(ans, n))


t = int(input())
for q in range(t):
	(n, g, b) = [int(i) for i in input().split()]
	num = n
	n = n // 2 + n % 2
	val = n // g
	d = 0
	if n % g == 0:
		d = (val - 1) * (b + g) + g
	else:
		d = val * (b + g) + n % g
	if d < num:
		print(num)
	else:
		print(d)


import sys
from math import ceil

def read():
	return sys.stdin.readline().strip()

def printf(a, sep=' ', end='\n'):
	sys.stdout.write(sep.join(map(str, a)) + end)

def readf():
	return [int(i) for i in read().split()]

def solve(n, g, b):
	k = n // 2 + n % 2
	a = k // g * (g + b)
	if k % g == 0:
		a -= b
	else:
		a += k % g
	return max(n, a)

def main():
	t = int(read())
	for i in range(t):
		(n, g, b) = readf()
		printf([solve(n, g, b)])
main()


for tt in range(int(input())):
	(n, g, b) = map(int, input().split())
	if g >= n:
		print(n)
		continue
	ans = (n + 1) // 2 // g * (g + b) - b
	left = (n + 1) // 2 % g
	if left:
		ans += left + b
	print(ans + max(0, n - ans))


import sys
import math
input = sys.stdin.readline
t = int(input())
while t > 0:
	t -= 1
	(n, g, b) = map(int, input().split())
	p = int(math.ceil(n / 2))
	q = p // g
	if q == 0:
		print(n)
	elif p % g != 0:
		print(max(n, q * g + q * b + p % g))
	else:
		print(max(n, q * g + (q - 1) * b))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	h = (n + 1) // 2
	ng = (h + (g - 1)) // g
	bd = (ng - 1) * b
	print(max(n, h + bd))


q = int(input())
for i in range(0, q):
	s = input()
	b = s.split(' ')
	n = int(b[0])
	g = int(b[1])
	b = int(b[2])
	t = n // 2 + n % 2
	k = (t - 1) // g
	print(max(n, t + k * b))


t = int(input())
for z in range(t):
	(n, g, p) = input().split()
	n = int(n)
	g = int(g)
	p = int(p)
	if n % 2 == 0:
		good = n // 2
	else:
		good = n // 2 + 1
	if good > g:
		s = good // g
		_sum = s * (g + p) - p
		if good % g != 0:
			_sum += p + good % g
			s += 1
	else:
		_sum = n
	if _sum >= n:
		print(_sum)
	else:
		print(n)


import math

def main():
	(n, g, b) = map(int, input().split())
	max_b = n // 2
	max_g = n - max_b
	if n <= 2 * g or g >= b:
		print(n)
		return 0
	parts = max_g // g
	days = parts * (g + b) + (max_g - parts * g)
	if max_g == parts * g:
		days -= b
	days = max(days, n)
	print(days)
t = int(input())
for i in range(t):
	main()


from sys import stdin, stdout
import traceback
read = stdin.readline
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	@classmethod
	def input(cls):
		s = cls()
		return s

	def solve(self):
		(n, g, b) = reads()
		if g >= b:
			return n
		req_good = n // 2 + n % 2
		if req_good <= g:
			return n
		period = req_good // g
		rest = req_good % g
		if req_good % g == 0:
			ret = (period - 1) * (g + b) + g
		else:
			ret = period * (g + b) + rest
		if ret < n:
			ret = n
		return ret
try:
	for _ in range(int(read())):
		writeln(Sol.input().solve())
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


from math import ceil

def main():
	t = int(input())
	for i in range(t):
		(n, g, b) = map(int, input().split())
		k = (n + 1) // 2
		a = ceil(k / g)
		print(max(a * (g + b) - b - (a * g - k), n))
main()


def Input():
	tem = input().split()
	ans = []
	for it in tem:
		ans.append(int(it))
	return ans
T = Input()[0]
for t in range(T):
	(n, g, b) = Input()
	half = int((n + 1) / 2)
	if half % g == 0:
		g_days = (int(half / g) - 1) * (g + b) + g
	else:
		g_days = int(half / g) * (g + b) + half % g
	if g_days >= n:
		print(g_days)
	else:
		print(n)


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	ned = (n + 1) // 2
	tot = ned // g * (g + b)
	if ned % g == 0:
		tot -= b
	else:
		tot += ned % g
	print(max(n, tot))


t = int(input())
while t > 0:
	(n, g, b) = map(int, input().split())
	hd = (n + 1) // 2
	tot = hd // g * (g + b)
	if hd % g == 0:
		tot -= b
	else:
		tot += hd % g
	print(max(n, tot))
	t -= 1


def ceil(a):
	if a // 1 == a:
		return int(a)
	else:
		return int(a) + 1
for i in range(0, int(input())):
	(n, g, b) = list(map(int, input().split()))
	if g >= b:
		print(n)
	else:
		u = ceil(n / 2)
		k = ceil(u / g) - 1
		if k * (g + b) + u - k * g < n:
			print(n)
		else:
			print(k * (g + b) + u - k * g)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	(n, g, b) = map(int, input().split())
	rd = mt.ceil(n / 2)
	rd1 = n // 2
	nd = mt.ceil(rd / g)
	days = (nd - 1) * b
	d1 = days
	days += nd * g
	req = nd * g
	days -= req - rd
	diff = max(rd1 - d1, 0)
	days += diff
	print(days)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	m = n // 2 + n % 2
	p = -m // g * -1
	d = p * g + (p - 1) * b
	if d > n:
		d -= min(d - n, g * p - m)
	elif d < n:
		d = n
	print(d)


from math import ceil
t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	if n % 2 == 0:
		half = n // 2
	else:
		half = n // 2 + 1
	if g >= half:
		print(n)
	elif half + (ceil(half / g) - 1) * b < n:
		print(n)
	else:
		print(half + (ceil(half / g) - 1) * b)


t = int(input())
for _ in range(t):
	arr = list(map(int, input().strip().split()))
	length = arr[0]
	gDays = arr[1]
	bDays = arr[2]
	if gDays > length:
		gDays = length
		print(gDays)
	else:
		needGDays = 0
		if length % 2 == 0:
			needGDays = length // 2
		else:
			needGDays = (length + 1) // 2
		if needGDays % gDays == 0:
			times = needGDays // gDays - 1
		else:
			times = needGDays // gDays
		days = times * (gDays + bDays) + (needGDays - times * gDays)
		if days < length:
			days = length
		print(days)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def solve():
	(n, g, b) = sep()
	if n % 2 == 0:
		mm = n // 2
	else:
		mm = n // 2 + 1
	if mm % g != 0:
		temp = mm // g
		ans = (g + b) * temp
		ans += mm - g * temp
		print(max(ans, n))
	else:
		temp = mm // g - 1
		ans = (g + b) * temp
		ans += mm - g * temp
		print(max(ans, n))
testcase(int(inp()))


T = int(input())
while T:
	T -= 1
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
		continue
	limit = n // 2
	cycle = limit // b
	n -= cycle * (g + b)
	ans = cycle * (g + b)
	limit -= cycle * b
	ans += min(n, g)
	n -= min(n, g)
	if n:
		if n <= limit:
			ans += n
		else:
			n -= limit
			ans += b
			if n % g == 0:
				ans += (n // g - 1) * (b + g) + g
			else:
				ans += n // g * (b + g)
				n -= n // g * g
				ans += n
	print(ans)


import math
t = int(input())
for io in range(t):
	(n, g, b) = map(int, input().split())
	if g >= b:
		days = n
	else:
		goods = math.ceil(n / 2)
		Badtimes = math.ceil(goods / g) - 1
		days = Badtimes * b + math.ceil(n / 2)
		if days < n:
			days = n
	print(days)


def solve(n, g, b):
	if n <= g:
		return n
	high_req = (n + 1) // 2
	t = g + b
	div = high_req // g
	remainder = high_req % g
	if remainder == 0:
		return max(n, t * (div - 1) + g)
	else:
		return max(n, t * div + remainder)
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	print(solve(n, g, b))


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	h = math.ceil(n / 2)
	g_needed = h // g
	remain = h % g
	flag = 0
	if remain:
		flag = 1
	if h < g:
		print(n)
	else:
		total = g * g_needed + b * (g_needed - 1 + flag) + remain + max(0, n - h - b * (g_needed - 1 + flag))
		print(total)


import math
for xyzc in range(0, int(input())):
	(n, g, b) = map(int, input().split())
	gd = math.ceil(n / 2)
	d = 0
	d += gd // g * (g + b)
	if gd % g == 0:
		d -= b
	else:
		d += gd % g
	print(max(d, n))


def good(x, n, g, b):
	z = x // (g + b)
	e = z * g
	f = z * b
	if x % (g + b) <= g:
		e += x % (g + b)
	else:
		e += g
		f += x % (g + b) - g
	if e < (n + 1) // 2:
		return 0
	if e + f >= n:
		return 1
	return 0
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	l = 0
	r = 10 ** 20
	res = -1
	while l <= r:
		mid = (l + r) // 2
		if good(mid, n, g, b):
			r = mid - 1
			res = mid
		else:
			l = mid + 1
	print(res)


import math

def min_days(arr):
	(l, g, b) = arr
	if g >= b:
		return l
	greqd = math.ceil(l / 2)
	return max(greqd + b * ((greqd - 1) // g), l)
T = int(input().strip())
for t in range(T):
	s = input().strip().split(' ')
	arr = list(map(int, s))
	print(min_days(arr))


T = int(input())
import math
for _ in range(T):
	(n, g, b) = map(int, input().split(' '))
	r = (n + 1) // 2
	bd = r // g
	if bd == 0:
		print(n)
		continue
	if r % g == 0:
		mg = bd * g + (bd - 1) * b
	else:
		mg = bd * (g + b) + r % g
	print(max(n, mg))


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	k = a
	if b >= a:
		print(a)
	else:
		a = (a + 1) // 2
		e = a // b * b + (a // b - int(a % b == 0)) * c + (a - a // b * b)
		if e < k:
			print(k)
		else:
			print(e)


def readLine():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(n, g, b) = readLine()
	ne = (n + 1) // 2
	lo = 1
	hi = (g + b) * n
	tot = b + g
	res = -1
	while lo <= hi:
		mid = (lo + hi) // 2
		q = mid // tot
		r = mid % tot
		good = q * g + min(r, g)
		if good >= ne and mid >= n:
			res = mid
			hi = mid - 1
		else:
			lo = mid + 1
	print(res)


test = eval(input())
for i in range(test):
	w = input()
	lst = w.split(' ')
	(n, g, b) = (int(lst[0]), int(lst[1]), int(lst[2]))
	k = (n + 1) // 2
	l = k / g
	if int(l) != l:
		res = k + int(l) * b
		if res >= n:
			print(int(res))
		else:
			remO = g * (int(l + 1) - l) + b
			remI = n - res
			if remI <= remO:
				res += remI
				print(int(res))
			else:
				print(n)
	else:
		res = k + int(l - 1) * b
		if res >= n:
			print(int(res))
		else:
			print(n)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(n, g, b) = list(map(int, input().split()))
	ALL = (n + 1) // 2
	ANS = n
	week = -(-ALL // g) - 1
	ANS = max(ANS, week * (g + b) + (ALL - week * g))
	print(ANS)


import sys
queries = int(sys.stdin.readline())
for query in range(queries):
	(need_asphalt, good_days, bad_days) = map(int, sys.stdin.readline().strip().split())
	need_good_asphalt = need_asphalt // 2 + need_asphalt % 2
	need_days = need_asphalt
	if good_days < need_good_asphalt:
		can_build_bad = need_asphalt - need_good_asphalt
		good_seasons = round(need_good_asphalt / good_days + 0.4999)
		need_good_asphalt -= good_days * (good_seasons - 1)
		need_days_tmp = good_days * (good_seasons - 1) + bad_days * (good_seasons - 1) + need_good_asphalt
		if need_days_tmp < need_asphalt:
			need_days_tmp = need_asphalt
		need_days = need_days_tmp
	print(need_days)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	(N, G, B) = map(int, readline().split())
	ok = 3 * 10 ** 18
	ng = -1
	W = G + B
	NN = -(-N // 2)
	while ok - ng > 1:
		med = (ok + ng) // 2
		(k, r) = divmod(med, W)
		r = min(G, r)
		if k * G + r >= NN:
			ok = med
		else:
			ng = med
	Ans[qu] = max(ok, N)
print('\n'.join(map(str, Ans)))


from math import *
t = int(input())
for y in range(t):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
		continue
	x = ceil(n / 2)
	a = (ceil(x / g) - 1) * b
	if a >= n // 2:
		print(a + x)
	else:
		print(x + n // 2)


import math
t = input()
for _ in range(int(t)):
	(n, g, b) = map(lambda x: int(x), input().split(' '))
	m = math.ceil(n / 2)
	if g >= m:
		print(n)
		continue
	i = math.ceil(m / g)
	if i >= 1:
		r = g - m % g if m % g > 0 else 0
		a = g * i + b * (i - 1) - r
		if a < n:
			print(n)
		else:
			print(a)
	else:
		print(n)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	x = (n + 1) // 2
	if x <= g:
		print(n)
	else:
		d = g
		x -= g
		c = x // g
		d += g * c + x % g
		if x % g == 0:
			d1 = b * c
		else:
			d1 = b * (c + 1)
		print(max(n, d1 + d))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	days = n
	if n % 2 == 0:
		n = n // 2
	else:
		n = n // 2 + 1
	req = n // g
	ans = 0
	if req != 0 and n % g == 0:
		ans += g
		req -= 1
	ans += req * (b + g) + n % g
	print(max(ans, days))


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def mex(li):
	check = [0] * 1001
	for i in li:
		check[i] += 1
	for i in range(len(check)):
		if check[i] == 0:
			return i

def sumdigits(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans
from math import *
from collections import deque
max_steps = 100005
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	atl = ceil(n / 2)
	tot = atl // g * (g + b)
	if atl % g == 0:
		tot -= b
	else:
		tot += atl % g
	print(max(n, tot))


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	[n, g, b] = [int(x) for x in stdin.readline().split()]
	minGood = n // 2 + n % 2
	fullCycles = minGood // g
	if n <= g:
		res = n
	elif minGood % g == 0:
		res = minGood + b * (fullCycles - 1)
	else:
		res = minGood + b * fullCycles
	stdout.write(str(max(n, res)) + '\n')


from math import ceil
testcases = int(input())
results = []
for i in range(testcases):
	[n, g, b] = [int(num) for num in input().split()]
	threshold = ceil(n / 2)
	min_cycles = threshold // g
	result = (min_cycles - 1) * (g + b) + g
	if min_cycles * g < threshold:
		result += b + (threshold - min_cycles * g)
	if result < n:
		result = n
	results.append(int(result))
for i in results:
	print(i)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	l = 0
	r = 1000000000000000000
	while r - l > 1:
		m = (r + l) // 2
		if m >= n and m // (g + b) * g + min(m % (g + b), g) >= (n + 1) // 2:
			r = m
		else:
			l = m
	print(r)


from math import *
for i in range(int(input())):
	(n, a, b) = map(int, input().split())
	g = ceil(n / 2)
	cycles = ceil(g / a)
	resto = max(n - cycles * (a + b), -b + g - cycles * a)
	print(cycles * a + cycles * b + resto)


import math

def main():
	t = int(input())
	for i in range(t):
		l = list(map(int, input().split(' ')))
		(n, g, b) = l
		h = math.ceil(n / 2)
		ans = 0
		rem = math.ceil(h / g)
		ans += g * rem
		ans += b * (rem - 1)
		if ans <= n:
			ans += n - ans
		elif ans > n:
			if (rem - 1) * b >= n - h:
				v = n - h + (rem - 1) * g
				ans -= g
				ans += n - v
			else:
				ans -= g
				ans += n - ((rem - 1) * g + (rem - 1) * b)
		print(ans)
main()


import math
num = int(input())
for _ in range(num):
	(n, g, b) = map(int, input().split())
	req = math.ceil(n / 2)
	d = req // g
	a = req % g
	if a == 0:
		ans = d * (g + b) - b
	else:
		ans = d * (g + b) + a
	print(max([ans, n]))


num_t = int(input())
for _ in range(num_t):
	(n, g, b) = map(int, input().split())
	d = 0
	(q1, r1) = divmod(n, g + b)
	(q2, r2) = divmod(n // 2, b)
	q = min(q1, q2)
	bbc = n // 2
	d += q * (g + b)
	n -= q * (g + b)
	bbc -= q * b
	t = min(g, n)
	d += t
	n -= t
	if n == 0:
		print(d)
		continue
	t = min(bbc, n)
	d += t
	n -= t
	if n == 0:
		print(d)
		continue
	d += b - t
	d += n + (n - 1) // g * b
	print(d)


tc = int(input())
for i in range(tc):
	(n, g, b) = list(map(int, input().split()))
	if n & 1:
		md = n // 2 + 1
		n -= md
	else:
		md = n // 2
		n = n // 2
	gdp = md // g + 1 if md // g * g < md else md // g
	bd = (gdp - 1) * b
	total = gdp * g + bd - (gdp * g - md)
	remd = total - md
	if n > remd:
		total += n - remd
	print(total)


import math
t = int(input())
while t:
	t -= 1
	(n, g, b) = map(int, input().split())
	m = (n + 1) // 2
	ans = (m - 1) // g * (g + b) + (m % g if m % g else g)
	print(max(ans, n))


from math import *
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
		continue
	a = (ceil(ceil(n / 2) / g) - 1) * b
	print(ceil(n / 2) + max(a, n // 2))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	low = n // 2
	lowcycle = low // b
	amari = low % b
	maxlow = (g + b) * lowcycle + g + amari
	if maxlow >= n:
		print(n)
	else:
		ans = (g + b) * (lowcycle + 1)
		ans += (n - maxlow) // g * (g + b) + (n - maxlow) % g
		if not (n - maxlow) % g:
			ans -= b
		print(ans)


def chk(m):
	k = min(g, m % (g + b))
	if m // (g + b) * g + k >= r:
		return True
	return False
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	mi = 0
	ma = 10 ** 20
	ans = 10 ** 18
	r = -(-n // 2)
	while mi < ma:
		m = (mi + ma) // 2
		if chk(m):
			ma = m
			ans = m
		else:
			mi = m + 1
	print(max(ans, n))


from math import ceil
T = int(input().strip())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	ans = None
	if g >= b:
		ans = n // (g + b) * (g + b) + n % (g + b)
	else:
		need = ceil(n / 2)
		ans = need // g * g + need % g + (ceil(need / g) - 1) * b
		ans = max(n, ans)
	print(ans)


from sys import stdin, stdout
import math
t = int(stdin.readline().strip())
for i in range(t):
	(n, g, b) = map(int, stdin.readline().strip().split())
	target = math.ceil(n / 2)
	loopcnt = (target - 1) // g
	if loopcnt * b >= n - target:
		ans = loopcnt * (g + b) + (target - loopcnt * g)
	else:
		ans = n
	stdout.writelines(str(ans) + '\n')


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for _ in range(int(input())):
	(n, g, b) = [int(x) for x in input().split()]
	needG = (n + 1) // 2
	totalG = needG // g * (b + g)
	if needG % g == 0:
		totalG += -b
	else:
		totalG += needG % g
	print(int(max(n, totalG)))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	minn = n // 2 + n % 2
	tot = minn // g * (g + b)
	if minn <= g:
		print(n)
		continue
	if n - minn - b * (minn // g) < 0:
		if minn % g == 0:
			tot -= b - max(0, n // 2 + b - b * (minn // g))
		else:
			tot += minn % g
		print(tot)
		continue
	left = minn % g + (n - minn - b * (minn // g))
	print(tot + left)


import math
for i in range(int(input())):
	(N, g, b) = map(int, input().split())
	if g >= N:
		print(N)
		continue
	half = math.ceil(N / 2)
	times = math.ceil(half / g)
	days = times * (g + b)
	if times * g > half:
		days -= b + (times * g - half)
	if times * g == half:
		days -= b
	if days < N:
		print(N)
	else:
		print(int(days))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = (n + 1) // 2
	cyc = (need + g - 1) // g
	ans = (g + b) * cyc - b
	ans -= (g - need % g) % g
	print(max(ans, n))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	req = n // 2 + n % 2
	g_req = n // (g + b)
	good = g_req * g
	if good + g < req:
		ex = req - (good + g)
		if ex % g:
			print((g_req + 1) * (b + g) + (b + g) * (ex // g) + ex % g)
		else:
			print((g_req + 1) * (b + g) + (b + g) * (ex // g - 1) + g)
	else:
		print(n + max(req - good - n % (b + g), 0))


from math import ceil, floor, gcd, sqrt, log2
for ttt in range(int(input())):
	(n, g, b) = map(int, input().split())
	good = ceil(n / 2)
	bad = n - good
	tot = good // g * (g + b)
	if good % g:
		tot += good % g
	else:
		tot -= b
	print(max(n, tot))


import math

def sec(l, g, b):
	if g > l:
		print(l)
		return
	total = g
	mid = math.ceil(l / 2) - g
	mid2 = math.floor(l / 2)
	left_off = mid % g
	g_days = math.ceil(mid / g)
	total += g_days * g
	bad_t = g_days * b
	total += bad_t
	if left_off:
		total -= g - left_off
	total += max(mid2 - bad_t, 0)
	print(max(total, l))

def runner():
	val = input()
	for i in range(int(val)):
		j = input().split()
		l = int(j[0])
		g = int(j[1])
		b = int(j[2])
		sec(l, g, b)
runner()


import time, math
from sys import stdin, stdout

def I():
	return int(stdin.readline())

def In():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def Si():
	return sorted(list(map(int, stdin.readline().split())))

def Si():
	return sorted(list(map(int, stdin.readline().split())), reverse=True)

def P(x):
	return stdout.write(str(x) + '\n')

def Pi(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def solve():
	for i in range(I()):
		(n, g, b) = In()
		mid = math.ceil(n / 2)
		ans = mid + (mid - 1) // g * b
		P(ans if ans >= n else n)
solve()


t = int(input())

def ceil(a, b):
	return a // b + (a % b > 0)
for _ in range(t):
	(n, g, b) = map(int, input().split())
	k = (ceil(n, 2) - 1) // g
	last = ceil(n, 2) - k * g
	ans = k * (g + b) + last
	print(max(ans, n))


for t in range(int(input())):
	s = input().split()
	n = int(s[0])
	g = int(s[1])
	b = int(s[2])
	G = (n + 1) // 2
	B = ((G + g - 1) // g - 1) * b
	print(max(n, G + B))


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	answer = n
	pair = g + b
	need = (n + 1) // 2
	print(max(n, (need - 1) // g * pair + (need - 1) % g + 1))


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	hq_req = (n + 1) // 2
	period_req = hq_req // g
	cost = period_req * (b + g)
	if period_req * g >= hq_req:
		cost -= b
	else:
		cost += hq_req % g
	print(max(cost, n))


import math
for i in range(int(input())):
	(n, good_d, bad_d) = map(int, input().split())
	min_high_q = math.ceil(n / 2)
	if good_d >= bad_d or good_d >= n:
		print(n)
		continue
	good_cycles = min_high_q / good_d
	good_cycles_floor = int(math.floor(good_cycles))
	bad_cycles = good_cycles_floor if good_cycles > good_cycles_floor else good_cycles_floor - 1
	total = bad_cycles * bad_d + min_high_q
	if total >= n:
		print(total)
		continue
	print(total + (n - total))


from math import ceil, floor
t = int(input())
while t:
	(n, g, b) = map(int, input().split())
	ng = ceil(n / 2)
	tg = floor(ng / g) * (g + b)
	if ng % g == 0:
		tg = tg - b
	else:
		tg += ng % g
	print(max(n, tg))
	t -= 1


t = int(input())
while t:
	(n, g, b) = map(int, input().split())
	if n % 2 == 0:
		good = n // 2
	else:
		good = n // 2 + 1
	if good % g == 0:
		total = good // g * g + (good // g - 1) * b
		print(max(total, n))
	else:
		total = good // g * g + good // g * b + good % g
		print(max(total, n))
	t -= 1


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
from math import floor
for _ in range(int(input())):
	(n, g, b) = get_ints()
	if g >= b:
		print(n)
	else:
		t = (n + 1) // 2
		print(max(n, t + (t - 1) // g * b))


from math import ceil

def Solve(n, g, b):
	half = ceil(n / 2)
	if g >= half:
		return n
	if half % g == 0:
		good = half // g
		bad = (good - 1) * b
		good = good * g
	else:
		good = half // g
		bad = good * b
		good = good * g + half % g
	return max(n, good + bad)
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	print(Solve(n, g, b))


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	good = math.ceil(n / 2)
	bad = 0
	if good / g - good // g == 0:
		bad = good // g - 1
	else:
		bad = good // g
	ans = bad * b + good
	if g >= n or g >= good:
		print(n)
	elif ans >= n:
		print(int(ans))
	else:
		print(int(n))


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if y >= (x + 1) // 2:
		print(x)
	else:
		p = (x + 1) // 2
		print(max((p - 1) // y * z + p, x))


for t in range(int(input())):
	(n, g, b) = map(int, input().split())
	gkm = n // 2 + n % 2
	if gkm <= g:
		print(n)
	else:
		m = gkm // g
		good = g * m
		bad = b * (m - 1)
		if good == gkm:
			if good + bad >= n:
				print(good + bad)
			else:
				print(n)
		else:
			bad += b
			good += gkm - good
			if good + bad >= n:
				print(good + bad)
			else:
				print(n)


def good(x, g, b):
	return x // (b + g) * g + min(x % (b + g), g)
t = int(input())
for i in range(t):
	(n, g, b) = tuple([int(x) for x in input().split()])
	lo = 0
	hi = (b + g) * n
	while hi - lo > 1:
		mid = (hi + lo) // 2
		if good(mid, g, b) >= (n + 1) // 2 and mid >= n:
			hi = mid
		else:
			lo = mid
	print(hi)


m = int(input())
import math
for i in range(m):
	(n, g, b) = map(int, input().split())
	need_good = n // 2 if n % 2 == 0 else n // 2 + 1
	if g >= b:
		print(n)
	else:
		roop = math.ceil(need_good / g)
		rest = n - (g * (roop - 1) + min(n - need_good, b * (roop - 1)))
		print(g * (roop - 1) + b * (roop - 1) + rest)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	count_s = (n + 1) // 2 / g
	if count_s != int(count_s):
		c = int(count_s)
	else:
		c = int(count_s - 1)
	count_s = int(count_s)
	count = g * count_s + (n + 1) // 2 - g * count_s
	if b * c >= n - count >= 0:
		print(count + b * c)
	else:
		print(n)


import math

def main():
	n = int(input())
	for i in range(n):
		solve()

def solve():
	(n, g, b) = list(map(int, input().split()))
	if g * 2 >= n:
		print(n)
		return
	total_good = math.ceil(n / 2)
	iterations = math.ceil(n / 2) // g
	remainder = math.ceil(n / 2) % g
	if remainder == 0:
		if (g + b) * (iterations - 1) + g < n:
			print(n)
		else:
			print((g + b) * (iterations - 1) + g)
	elif (g + b) * iterations + remainder < n:
		print(n)
	else:
		print((g + b) * iterations + remainder)
main()


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	a = math.ceil(n / 2)
	if g >= n:
		print(n)
	elif g >= a:
		print(n)
	else:
		d = math.ceil(a / g)
		c = a + (d - 1) * b
		if c - n < 0:
			print(n)
		else:
			print(c)


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import ceil
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
test = int_input()
for _ in range(test):
	(n, g, b) = multi_int_input()
	if g >= n:
		print(n)
	else:
		mini = ceil(n / 2)
		no_good = mini // g
		remainder = mini % g
		first_ans = no_good * g + (no_good - 1) * b
		if remainder != 0:
			first_ans = first_ans + b + remainder
		if first_ans >= n:
			print(first_ans)
		else:
			print(n)


T = int(input())
for _ in range(T):
	(n, g, b) = map(int, input().split())
	if g >= b:
		print(n)
	else:
		good = n - n // 2
		bad = n // 2
		x = good // g
		r = good % g
		y = bad // b
		s = bad % b
		if r == 0:
			x -= 1
			r = g
		if s == 0:
			y -= 1
			s = b
		if x == y:
			print(x * (g + b) + r + s)
		else:
			print(x * (g + b) + r)


from math import ceil
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	mgd = ceil(n / 2)
	mgc = mgd // g
	cl = g + b
	if mgc * g < mgd:
		md = mgc * cl + mgd - mgc * g
	else:
		md = (mgc - 1) * cl + g
	print(md if md > n else n)


t = int(input())
for i in range(t):
	(n, g, b) = list(map(int, input().split()))
	half = n // 2
	if n % 2 != 0:
		half += 1
	gct = half // g
	ex = half % g
	if ex != 0:
		bct = gct
	else:
		bct = gct - 1
	ct = gct * g + bct * b + ex
	if ct < n:
		print(n)
	else:
		print(ct)


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	nm = n
	n = (n + 1) // 2
	gd = (b + g) * (n // g)
	if n % g == 0:
		gd -= b
	else:
		gd += n % g
	print(max(nm, gd))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	need = n // 2 + n % 2
	if need <= g:
		print(n)
	else:
		k = b * (math.ceil(need / g) - 1) + need
		if k >= n:
			print(k)
		else:
			print(n)


import math
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split(' '))
	newn = math.ceil(n / 2)
	c = 0
	if newn % g == 0:
		c = newn + (newn // g - 1) * b
	else:
		c = newn + newn // g * b
	if c < n:
		print(n)
	else:
		print(int(c))


t = int(input())
for i in range(t):
	(n, g, b) = [int(x) for x in input().split()]
	ans = 0
	half = (n >> 1) + (n & 1)
	ans = (half // g - 1) * (g + b)
	if half % g == 0:
		ans += g
	else:
		ans += g + b + half % g
	print(max(ans, n))


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, g, b) = map(int, input().split())
		good = (n + 1) // 2
		cycles = (good - 1) // g
		rem = good - cycles * g
		print(max(n, cycles * (g + b) + rem))
	q = int(input())
	for _ in range(q):
		solve()
main()


import sys
input = sys.stdin.readline
t = int(input())
for case in range(t):
	(n, g, b) = map(int, input().split())
	(lo, hi) = (1, 100000000000000000000)
	if g >= n:
		print(n)
		continue
	while lo < hi:
		mid = lo + hi >> 1
		amount = mid // (g + b)
		good = g * amount
		bad = b * amount
		if mid % (g + b) <= g:
			good += mid % (g + b)
		else:
			good += g
			bad += mid % (g + b) - g
		if good >= (n + 1) // 2 and good + bad >= n:
			hi = mid
		else:
			lo = mid + 1
	print(hi)


t = int(input())
for counter in range(t):
	array = [int(x) for x in input().split()]
	allowed = array[0] // 2
	finished = 0
	g = array[1]
	b = array[2]
	cycle = g + b
	progress = cycle * (allowed // b)
	ans = progress
	leftover = allowed % b
	remaining = array[0] - progress
	if remaining <= g + leftover:
		ans += remaining
	else:
		ans += cycle
		progress += g + leftover
		remaining = array[0] - progress
		if remaining % g == 0:
			ans += remaining // g * cycle - b
		else:
			ans += remaining // g * cycle + remaining % g
	print(ans)


def A():
	n = int(input())
	for i in range(n):
		t = 0
		for c in input().strip('0'):
			if c == '0':
				t += 1
		print(t)

def B():
	T = int(input())
	for i in range(T):
		(n, g, b) = (int(v) for v in input().split())
		if b <= g:
			print(n)
			continue
		required_good = n // 2 + n % 2
		(q, r) = divmod(required_good, g)
		if r == 0:
			required_days = q * (g + b) - b
		else:
			required_days = q * (g + b) + r
		print(max(required_days, n))
B()


T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split())
	good = (n - 1) // 2 + 1
	bad = n - good
	if good % g == 0:
		if good == 0:
			print(n)
			continue
		a = (good // g - 1) * b
		ans = (good // g - 1) * (g + b) + g + max(bad - a, 0)
		print(ans)
	else:
		a = good // g * b
		ans = good // g * (g + b) + good % g + max(bad - a, 0)
		print(ans)


T = int(input())
for i in range(T):
	(n, g, b) = map(int, input().split())
	ming = (n + 1) // 2
	gcycles = ming // g
	grem = ming % g
	if grem == 0:
		grem = g
		gcycles -= 1
	print(max(gcycles * (g + b) + grem, n))


import math
for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	p = math.ceil(n / 2)
	needg = p
	totalg = needg // g * (g + b)
	if needg % g == 0:
		totalg = totalg - b
	else:
		totalg = totalg + needg % g
	print(max(n, totalg))


a = int(input())
for i in range(a):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
		continue
	if n % 2 == 1:
		pak = n // 2 + 1
	else:
		pak = n // 2
	l = pak // g
	r = pak % g
	if r == 0:
		days = (g + b) * l - b
	else:
		days = (g + b) * l + r
	if n <= days:
		print(days)
	else:
		print(n)


t = int(input())
for _ in range(t):
	st = list(map(int, input().split()))
	n = (st[0] + 1) // 2
	x = n // st[1]
	y = n % st[1]
	if y == 0:
		y = st[1]
		x -= 1
	ans = max(st[0], x * (st[1] + st[2]) + y)
	print(int(ans))


for _ in range(int(input())):
	(t, g, b) = map(int, input().split())
	h = int((t + 1) / 2)
	b = int((h + g - 1) / g - 1) * b
	g = int(h // g * g + h % g)
	n = g + b
	if n >= t:
		print(n)
	else:
		print(t)


def I():
	return list(map(int, input().split()))
import math
for t in range(int(input())):
	(n, g, b) = I()
	x = n
	n = math.ceil(n / 2)
	numTimes = (g + b) * (n // g)
	if n % g == 0:
		s = numTimes - b
	else:
		s = numTimes + n % g
	if s < x:
		s = x
	print(s)


import sys
import math
T = int(sys.stdin.readline())
for t in range(T):
	[n, g, b] = [int(i) for i in sys.stdin.readline().split()]
	fac = math.ceil(n / 2) // g
	rem = math.ceil(n / 2) % g
	hq = fac * g + rem
	bad = 0
	if rem == 0:
		bad = fac - 1
	else:
		bad = fac
	days = hq + b * bad
	ans = max(n, days)
	print(ans)


t = int(input())
for ti in range(t):
	(n, g, b) = (int(i) for i in input().split(' '))
	if n <= g:
		print(n)
		continue
	elif n <= g + b:
		if g >= b:
			print(n)
		else:
			to_do = n + 1 >> 1
			tot = g + b
			loop = to_do // g
			rem = to_do % g
			ans = loop * tot
			if rem:
				ans += rem
			else:
				ans -= b
			if ans < n:
				ans += n - ans
			print(ans)
	elif n > g + b:
		if b > g or (n & 1 and g == b):
			to_do = n + 1 >> 1
			tot = g + b
			loop = to_do // g
			rem = to_do % g
			ans = loop * tot
			if rem:
				ans += rem
			else:
				ans -= b
			if ans < n:
				ans += n - ans
		else:
			ans = n
		print(ans)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	c = n // 2 + n % 2
	d = n // 2
	y = c // g
	z = c % g
	t = 0
	if z == 0:
		t += (y - 1) * b
	else:
		t += y * b
	t += y * g + z
	if t >= n:
		print(t)
	else:
		print(n)


t = int(input())

def f(n, g, b):
	ideal = (n + 1) // 2
	ost = n - ideal
	ans = 0
	pb = 0
	if n == 1:
		return 1
	if ideal % g == 0:
		pb = ideal // g - 1
	else:
		pb = ideal // g
	if ideal + pb * b >= n:
		return ideal + pb * b
	else:
		return n
for i in range(t):
	l = input()
	n = int(l.split()[0])
	g = int(l.split()[1])
	b = int(l.split()[2])
	print(f(n, g, b))


import math
t = int(input())
for _ in range(t):
	arr = list(map(int, input().split()))
	n = arr[0]
	g = arr[1]
	b = arr[2]
	half_days = (n + 1) // 2
	rem_days = n - half_days
	weeks = math.ceil(half_days / g)
	count = min(rem_days, (weeks - 1) * b)
	rem_days -= count
	if rem_days < 0:
		rem_days = 0
	rem = 0
	if half_days - weeks * g > 0:
		rem = b
	ans = weeks * g + (weeks - 1) * b + (half_days - weeks * g) + rem_days + rem
	print(ans)


import math

def solution(n: int, g: int, b: int):
	need_good = int((n + 1) // 2)
	mult = need_good // g
	ans = mult * (g + b)
	if need_good % g == 0:
		ans = ans - b
	else:
		ans += need_good % g
	return max(ans, n)

def main():
	t = int(input())
	while t:
		(n, g, b) = map(int, input().strip().split())
		ans = solution(n, g, b)
		print(ans)
		t -= 1
main()


import math
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	tempn = math.ceil(n / 2)
	temp = tempn // g
	addOn = tempn % g
	if g >= tempn:
		print(n)
	else:
		if addOn == 0:
			ans = temp * (g + b) - b
			if ans < n:
				ans = n
		else:
			ans = temp * (g + b) + addOn
			if ans < n:
				ans = n
		print(ans)


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	(x, y) = divmod((n + 1) // 2, g)
	print(max(n, x * (g + b) + (y if y else -b)))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		r = (n + 1) // 2
		q = r // g
		mod = r % g
		if mod:
			res = (g + b) * q + mod
		else:
			res = (g + b) * q - b
		print(max(res, n))


import math
t = int(input())
for case in range(t):
	(n, g, b) = map(int, input().split())
	turn = math.ceil((1 + n) // 2 / g)
	if (-1 + turn) * b >= n - (1 + n) // 2:
		print((1 + n) // 2 + (-1 + turn) * b)
	else:
		print(n)


import math
T = int(input())

def solve(n, a, b):
	good = math.ceil(n / 2)
	(q, r) = divmod(good, a)
	time_good = q * (a + b) + r
	if r == 0:
		assert q > 0
		time_good = q * a + (q - 1) * b
	time_all = n
	return max(time_good, time_all)
for _ in range(T):
	(N, A, B) = [int(x) for x in input().split()]
	print(solve(N, A, B))


import math

def solution(n, g, b):
	half = math.ceil(n / 2)
	full_rotations_needed = math.floor(half / g)
	ans = max(0, full_rotations_needed * (g + b))
	if full_rotations_needed * g >= half:
		ans -= b
	else:
		ans += half % g
	return max(n, ans)
n = int(input())
for _ in range(n):
	(n, g, b) = map(int, input().split(' '))
	print(solution(n, g, b))


INT_MAX = 10 ** 11 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
import math as M

def calc(n, g, b):
	if g >= b:
		return n
	minblocks = int(M.ceil(int(M.ceil(n / 2)) / g)) - 1
	mindays = minblocks * (g + b)
	req = int(M.ceil(n / 2)) - g * minblocks
	mindays += req
	return max(mindays, n)
for _ in range(int(input())):
	(n, g, b) = INPUT()
	print(calc(n, g, b))


import math
n = int(input())
for i in range(n):
	(n, g, b) = list(map(int, input().split()))
	if b <= g:
		print(n)
	else:
		m = (n + 1) // 2
		if m <= g:
			print(n)
		elif m % g == 0:
			print(max(n, m + (m // g - 1) * b))
		else:
			print(max(n, m + m // g * b))


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split(' '))
	if n % 2 == 0:
		x = n // 2
	else:
		x = n // 2 + 1
	if g >= x:
		print(n)
	else:
		y = x // g
		y1 = x % g
		ans = y * (b + g) + y1
		if y1 == 0:
			ans -= b
		if ans < n:
			m = n - ans
			ans += m
		print(ans)


T = int(input())
for h in range(T):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	elif g >= b:
		print(n)
	elif b > g:
		k = (n + 1) // 2
		h = k // g
		alpha = (h - 1) * b + h * g
		if k % g != 0:
			alpha = alpha + b + k % g
		print(max(n, alpha))


def iinput():
	return [int(x) for x in input().split()]

def main():
	(n, g, b) = iinput()
	z = (n + 1) // 2
	d = (z - 1) // g
	return max(d * b + z, n)
for i in range(int(input())):
	print(main())


import math
for t in range(int(input())):
	(n, g, b) = map(int, input().split())
	if n <= g:
		print(n)
	else:
		x = math.ceil(n / 2)
		y = n - x
		gd = x // g
		grem = x % g
		bd = (gd - 1) * b
		if grem != 0:
			bd += b
		ans = gd * g + bd + grem
		if bd < y:
			ans += y - bd
		print(ans)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)
input = sys.stdin.readline

def ceil(n, k):
	return n // k + (n % k != 0)

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

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	(n, g, b) = mi()
	tg = math.ceil(n / 2)
	x = (tg - 1) // g
	r = tg - x * g
	print(max(n, x * (g + b) + r))


import math
q = int(input())
while q:
	q += -1
	(n, g, b) = map(int, input().split())
	good = math.ceil(n / 2)
	cycle = good // g
	days = 0
	if good % g:
		days += cycle * (g + b) + good % g
	else:
		days += cycle * g + (cycle - 1) * b
	print(max(n, days))


import math

def solve(n, g, b):
	needg = math.ceil(n / 2)
	totalg = needg // g * (g + b)
	if needg % g > 0:
		totalg += needg % g
	if needg % g == 0:
		totalg -= b
	print(max(n, totalg))
t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	solve(n, g, b)


t = int(input())
for i in range(t):
	(n, g, b) = map(int, input().split())
	if n % 2 != 0:
		rem = n // 2 + 1
	elif n % 2 == 0:
		rem = n // 2
	get = rem // g * (g + b)
	if rem % g > 0:
		get += rem % g
	else:
		get -= b
	print(max(n, get))


for _ in range(int(input())):
	(n, g, b) = map(int, input().split())
	high = (n + 1) // 2
	days = high // g * (b + g)
	days += -b if high % g == 0 else high % g
	print(max(days, n))


from math import ceil
for _ in range(int(input())):
	(n, g, b) = list(map(int, input().split()))
	if g >= b:
		print(n)
	else:
		m = (n + 1) // 2
		a = (m - 1) // g
		if a == 0:
			print(n)
		else:
			z = (g + b) * a + (m - 1) % g + 1
			print(n if z < n else z)


from math import ceil
t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().split())
	gd = ceil(n / 2)
	k = ceil(gd / g)
	if k == 1:
		print(n)
		continue
	days = (k - 1) * (g + b) + gd - (k - 1) * g
	if days < n:
		print(n)
	else:
		print(days)


for i in range(int(input())):
	(n, g, b) = (int(s) for s in input().split())
	m = (n + 1) // 2
	print(max(n, (m - 1) // g * b + m))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def highway():
	for _ in range(t):
		(n, g, b) = map(int, input().split())
		if n % 2 == 0:
			half = n // 2
		else:
			half = n // 2 + 1
		otherhalf = n - half
		if half // g == 0:
			yield n
		elif half % g == 0:
			otherhalfcommit = (half // g - 1) * b
			if otherhalfcommit < otherhalf:
				yield ((half // g - 1) * (g + b) + (half - (half // g - 1) * g) + (otherhalf - otherhalfcommit))
			else:
				yield ((half // g - 1) * (g + b) + (half - (half // g - 1) * g))
		else:
			otherhalfcommit = half // g * b
			if otherhalfcommit < otherhalf:
				yield (half // g * (g + b) + half % g + (otherhalf - otherhalfcommit))
			else:
				yield (half // g * (g + b) + half % g)
t = int(input())
ans = highway()
print(*ans, sep='\n')


import math
t = int(input())
for test in range(0, t):
	(n, g, b) = map(int, input().split())
	nd = int((n + 1) / 2)
	ans = int(nd / g) * (g + b)
	rem = nd % g
	if rem == 0:
		ans -= b
	else:
		ans += rem
	print(max(n, ans))


test = int(input(''))
while test:
	test -= 1
	s = input('')
	(n, g, b) = map(int, s.split(' '))
	x = n
	if n % 2 == 0:
		n = int(n / 2)
	else:
		n = int((n + 1) / 2)
	if g >= n:
		print(int(x))
	else:
		num = 0
		if n % g != 0:
			num = 1
		else:
			num = 0
		m = int(n / g) + num
		sum = n + (m - 1) * b
		sum = int(sum)
		if sum >= x:
			print(int(sum))
		else:
			print(int(x))


def solve():
	t = int(input())
	for _ in range(t):
		(n, g, b) = map(int, input().split())
		at_least_good = (n + 1) // 2
		at_most_bad = n - at_least_good
		full_good = at_least_good // g
		if at_least_good % g == 0:
			good_time = full_good * g
			bad_time = (full_good - 1) * b
			at_most_bad -= min(bad_time, at_most_bad)
			at_least_good -= good_time
			time = good_time + bad_time
			time_left = at_most_bad
			print(time + time_left)
		else:
			good_time = full_good * g
			bad_time = full_good * b
			at_most_bad -= min(bad_time, at_most_bad)
			at_least_good -= good_time
			time = full_good * (g + b)
			time_left = at_least_good + at_most_bad
			print(time + time_left)
solve()


import math

def getSeq(n, g, b):
	need = math.ceil(n / 2)
	d = math.ceil(need / g) - 1
	td = d * (g + b)
	td += need - d * g
	return max(td, n)
T = int(input())
for i in range(T):
	(n, g, b) = list(map(int, input().split()))
	print(getSeq(n, g, b))


T = int(input())
for case in range(T):
	(n, g, b) = list(map(int, input().split()))
	desired = n // 2
	if n % 2 == 1:
		desired += 1
	blocks = desired // g
	num_days = 0
	num_days = blocks * (g + b) + (desired - g * blocks)
	if g * blocks == desired:
		num_days -= b
	num_days = max(num_days, n)
	print(num_days)


t = int(input())
for _ in range(t):
	(n, g, b) = map(int, input().strip().split())
	g_needed = 0
	if n % 2 == 1:
		g_needed = n // 2 + 1
	else:
		g_needed = n // 2
	if g_needed <= g:
		print(n)
	else:
		b_needed = 0
		if g_needed % g == 0:
			b_needed = b * (g_needed // g - 1)
		else:
			b_needed = b * (g_needed // g)
		if g_needed + b_needed < n:
			print(n)
		else:
			print(g_needed + b_needed)


for tests in range(int(input())):
	(n, g, b) = map(int, input().split())
	gr = int((n + 1) / 2)
	br = n - gr
	if gr <= g:
		print(n)
	else:
		k = int(gr / g)
		gd = k * g
		dd = k * (g + b) - b
		if gd == gr:
			if dd >= n:
				print(dd)
			else:
				print(n)
		else:
			dd += gr - gd + b
			if dd >= n:
				print(dd)
			else:
				print(n)