Answers for "alarm clock question codeforces polycarp"

0

alarm clock question codeforces polycarp

t = int(input())
for _ in range(t):
	a, b, c, d = map(int, input().split())
	if b >= a:
		print(b)
		continue
	if c <= d:
		print(-1)
		continue
	a -= b
	dif = c - d
	print(b + (a + dif - 1) // dif * c)
Posted by: Guest on November-29-2020

Browse Popular Code Answers by Language