15 lines
301 B
Python
15 lines
301 B
Python
|
import math
|
||
|
|
||
|
|
||
|
def main():
|
||
|
n, x, y = map(int, input().split())
|
||
|
|
||
|
rapp = int(y/x) # à partir de cb
|
||
|
if rapp > 0:
|
||
|
return math.ceil(math.log2(n)-math.log2(int(y/x)))*(x+y)+int(y/x)*x
|
||
|
|
||
|
return math.ceil(math.log2(n))*(x+y)
|
||
|
|
||
|
|
||
|
for _ in range(int(input())):
|
||
|
print(main())
|