Increasing COVID cases have created panic amongst the people of Chefland, so the government is starting to push for production of a vaccine. It has to report to the media about the exact date when vaccines will be available.
There are two companies which are producing vaccines for COVID. Company A starts producing vaccines on day $D_1$ and it can produce $V_1$ vaccines per day. Company B starts producing vaccines on day $D_2$ and it can produce $V_2$ vaccines per day. Currently, we are on day $1$.
We need a total of $P$ vaccines. How many days are required to produce enough vaccines? Formally, find the smallest integer $d$ such that we have enough vaccines at the end of the day $d$.

-----Input-----
- The first and only line of the input contains five space-separated integers $D_1$, $V_1$, $D_2$, $V_2$ and $P$.

-----Output-----
Print a single line containing one integer ― the smallest required number of days.

-----Constraints-----
- $1 \le D_1, V_1, D_2, V_2 \le 100$
- $1 \le P \le 1,000$

-----Subtasks-----
Subtask #1 (30 points): $D_1 = D_2$
Subtask #2 (70 points): original constraints

-----Example Input 1-----
1 2 1 3 14

-----Example Output 1-----
3

-----Explanation-----
Since $D_1 = D_2 = 1$, we can produce $V_1 + V_2 = 5$ vaccines per day. In $3$ days, we produce $15$ vaccines, which satisfies our requirement of $14$ vaccines.

-----Example Input 2-----
5 4 2 10 100

-----Example Output 2-----
9

-----Explanation-----
There are $0$ vaccines produced on the first day, $10$ vaccines produced on each of days $2$, $3$ and $4$, and $14$ vaccines produced on the fifth and each subsequent day. In $9$ days, it makes a total of $0 + 10 \cdot 3 + 14 \cdot 5 = 100$ vaccines.

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
try:
	(d1, v1, d2, v2, p) = map(int, input().split())
	total = 0
	while p > 0:
		total += 1
		if total >= d1:
			p = p - v1
		if total >= d2:
			p = p - v2
	print(total)
except:
	pass


(d1, v1, d2, v2, p) = list(map(int, input().split()))
check = 0
if d1 == d2:
	check = 1
	start = d1 - 1
	v0 = v1 + v2
	if p % v0 == 0:
		print(p // v0 + start)
	else:
		print(p // v0 + 1 + start)
elif d2 < d1:
	con = d2
	pon = d1
	von = v2
else:
	con = d1
	pon = d2
	von = v1
if check != 1:
	starting_day = con - 1
	second = pon - con
	third = second * von
	if third > p:
		if p % von == 0:
			print(p // von + starting_day)
		else:
			print(p // von + 1 + starting_day)
	elif third == p:
		print(second + starting_day)
	else:
		v0 = v2 + v1
		if (p - third) % v0 == 0:
			print((p - third) // v0 + second + starting_day)
		else:
			print((p - third) // v0 + second + starting_day + 1)


(d1, v1, d2, v2, vaccine) = map(int, input().split())
day = 1
sum = 0
while sum < vaccine:
	if day == d1:
		sum += v1
		d1 += 1
	if day == d2:
		sum += v2
		d2 += 1
	if sum >= vaccine:
		break
	day += 1
print(day)


(d1, v1, d2, v2, p) = list(map(int, input().split()))
store = 0
vac = 0
small = 0
i = 0
if d1 == d2:
	store = p // (v1 + v2)
	if store * (v1 + v2) < p:
		store += 1
	if d1 > 1:
		store += d1 - 1
	print(store)
else:
	diff = abs(d1 - d2)
	if d1 < d2:
		small = d1
		vac = v1
	else:
		small = d2
		vac = v2
	while store < p:
		if i >= diff:
			store += v1 + v2
		else:
			store += vac
		i += 1
	print(i + small - 1)


(d1, v1, d2, v2, p) = list(map(int, input().split()))
if d1 == d2:
	store = p // (v1 + v2)
	if store * (v1 + v2) < p:
		store += 1
	if d1 > 1:
		store += d1 - 1
	print(store)


day = 1
(d1, v1, d2, v2, p) = map(int, input().split())
d1 = abs(d1)
v1 = abs(v1)
d2 = abs(d2)
v2 = abs(v2)
p = abs(p)
vaccines = 0
while 1:
	if day >= d1:
		vaccines += v1
	if day >= d2:
		vaccines += v2
	if vaccines >= p:
		break
	day += 1
print(day)


vacc = 0
day = 0
(d1, v1, d2, v2, p) = list(map(int, input().split()))
for i in range(1, 1000):
	if i >= d1:
		vacc = vacc + v1
	if i >= d2:
		vacc = vacc + v2
	day = day + 1
	if vacc >= p:
		break
print(day)


try:
	a = list(map(int, input().split()))
	d1 = a[0]
	v1 = a[1]
	d2 = a[2]
	v2 = a[3]
	p = a[4]
	vacc = 0
	day = 0
	for i in range(1, 1000):
		if i >= d1:
			vacc = vacc + v1
		if i >= d2:
			vacc = vacc + v2
		day = day + 1
		if vacc >= p:
			break
	print(day)
except:
	pass


(d1, v1, d2, v2, n) = map(int, input().split())
(l, i, j, day) = (0, 1, 1, 0)
while l < n:
	if i >= d1:
		l += v1
	if j >= d2:
		l += v2
	i += 1
	j += 1
	day += 1
print(day)


(d1, v1, d2, v2, p) = input().split()
d1 = int(d1)
v1 = int(v1)
d2 = int(d2)
v2 = int(v2)
p = int(p)
if d1 == d2:
	if p % (v1 + v2) == 0:
		rd = int(p / (v1 + v2)) + d1 - 1
	else:
		rd = int(p // (v1 + v2)) + d1
elif d1 < d2:
	dd = d2 - d1
	vp = v1 * dd
	if p <= dd:
		if p % v1 == 0:
			rd = int(p / v1) + d1 - 1
		else:
			rd = int(p // v1) + d1
	else:
		vl = p - vp
		if vl % (v1 + v2) == 0:
			rd = int(vl / (v1 + v2)) + d2 - 1
		else:
			rd = int(vl // (v1 + v2)) + d2
else:
	dd = d1 - d2
	vp = v2 * dd
	if p <= vp:
		if p % v2 == 0:
			rd = int(p / v2) + d2 - 1
		else:
			rd = int(p // v2) + d2
	else:
		vl = p - vp
		if vl % (v1 + v2) == 0:
			rd = int(vl / (v1 + v2)) + d1 - 1
		else:
			rd = int(vl // (v1 + v2)) + d1
print(rd)


import math as m
NUMBER = input().split()
D1 = int(NUMBER[0])
V1 = int(NUMBER[1])
D2 = int(NUMBER[2])
V2 = int(NUMBER[3])
P = int(NUMBER[4])
number_vaccine = 0
count = 0
if D1 > D2:
	print(D1 - 1 + m.ceil((P - V2 * abs(D1 - D2)) / (V1 + V2)))
elif D1 == D2:
	count = D1 - 1
	print(D1 + m.ceil(P / (V1 + V2)) - 1)
else:
	print(D2 - 1 + +m.ceil((P - V1 * abs(D1 - D2)) / (V1 + V2)))


NUMBER = input().split()
D1 = int(NUMBER[0])
V1 = int(NUMBER[1])
D2 = int(NUMBER[2])
V2 = int(NUMBER[3])
P = int(NUMBER[4])
number_vaccine = 0
count = 0
if D1 > D2:
	count = D2 - 1
	number_vaccine = V2 * (D1 - D2)
	count += D1 - D2
	while number_vaccine < P:
		number_vaccine += V1 + V2
		count += 1
	print(count)
elif D1 == D2:
	count = D1 - 1
	while number_vaccine < P:
		number_vaccine += V1 + V2
		count += 1
	print(count)
else:
	count = D1 - 1
	number_vaccine = V1 * (D2 - D1)
	count += D2 - D1
	while number_vaccine < P:
		number_vaccine += V1 + V2
		count += 1
	print(count)