A car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green light is on, then for the following r seconds the red light is on, then again the green light is on for the g seconds, and so on.

The car can be instantly accelerated from 0 to v and vice versa, can instantly slow down from the v to 0. Consider that it passes the traffic lights at the green light instantly. If the car approaches the traffic lights at the moment when the red light has just turned on, it doesn't have time to pass it. But if it approaches the traffic lights at the moment when the green light has just turned on, it can move. The car leaves point A at the time 0.

What is the minimum time for the car to get from point A to point B without breaking the traffic rules?

Input

The first line contains integers l, d, v, g, r (1 ≤ l, d, v, g, r ≤ 1000, d < l) — the distance between A and B (in meters), the distance from A to the traffic lights, car's speed, the duration of green light and the duration of red light.

Output

Output a single number — the minimum time that the car needs to get from point A to point B. Your output must have relative or absolute error less than 10 - 6.

Examples

Input

2 1 3 4 5


Output

0.66666667


Input

5 4 3 1 1


Output

2.33333333

Difficulty: MEDIUM
Tags: Implementation

Starter code:

Solutions:
(l, d, v, g, r) = map(int, input().split())
z = d / v
y = (l - d) / v
temp = z
light = True
x = 0
while 1:
	if x % 2 == 0:
		if temp >= g:
			temp -= g
			light = False
		else:
			break
	elif temp >= r:
		temp -= r
		light = True
	else:
		break
	x += 1
if light:
	print('{0:.8f}'.format(z + y))
else:
	print('{0:.8f}'.format(z + (r - temp) + y))


while True:
	try:
		(l, d, v, g, r) = map(int, input().split())
		t = d // v // (g + r)
		a = d / v - t * (g + r)
		eps = 1e-08
		if abs(a - g) < eps:
			ans = l / v + r
		elif a < g:
			ans = l / v
		else:
			ans = g + r - a + l / v
		print('%.8f' % ans)
	except EOFError:
		break


str1 = input().split()
l = int(str1[0])
d = int(str1[1])
v = int(str1[2])
g = int(str1[3])
r = int(str1[4])
t = 0.0
t += d / v
tt = l / v
delay = 0.0
flag = True
n = 1
while flag:
	min = n * g + (n - 1) * r
	max = n * g + n * r
	if t > max:
		n += 1
		continue
	if t >= min and t <= max:
		delay = max - t
		break
	else:
		break
print(tt + delay)


(l, d, v, g, r) = map(int, input().split())
modulus = g + r
time_to_light = d / v
t = time_to_light
arrival = time_to_light % modulus
if arrival >= g:
	t += r + g - arrival
t += (l - d) / v
print(t)


(l, d, v, g, r) = list(map(int, input().split(' ')))
t = l / v
t1 = d / v
x = g
while x <= t1:
	x += r
	if x > t1:
		t += x - t1
	x += g
print(t)


(td, pd, sp, g, r) = map(int, input().split())
it = pd / sp
if it < g:
	ntt = td / sp
	print('%.8f' % ntt)
elif it > g + r:
	tr = it + (g + r)
	if it % (g + r):
		print('%.8f' % tr)
else:
	nt = r + g + (td - pd) / sp
	print('%.8f' % nt)


(l, d, v, g, r) = map(int, input().split())
t = d / v
c = 0
while t > g + r:
	t -= g + r
	c += 1
if t < g:
	print(l / v)
elif t <= g + r:
	c += 1
	print(c * (g + r) + (l - d) / v)


import sys

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

def iinput():
	return int(input())

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

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(l, d, v, g, r) = rinput()
time = d / v % (g + r)
ans = l / v
if time < g:
	print(ans)
else:
	ans += r + g - time
	print(ans)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(l, d, v, g, r) = iia()
t = d / v
if t % (g + r) >= g:
	t += g + r - t % (g + r)
t += (l - d) / v
print(t)


while True:
	try:
		(l, d, v, g, r) = map(int, input().split())
		acc = d / v % (g + r)
		ans = l / v
		if acc >= g:
			ans += g + r - acc
		print(ans)
	except EOFError:
		break


(L, d, v, g, r) = map(int, input().split())
t1 = d / v
faza = t1 % (g + r)
if faza >= g:
	t2 = g + r - faza
else:
	t2 = 0
t3 = (L - d) / v
print(t1 + t2 + t3)


(dist, toLight, maxSpeed, green, red) = map(int, input().split())
f = toLight // maxSpeed
t = 0
for i in range(1010):
	if i % 2 == 0:
		if t <= f < t + green:
			print(toLight * 1.0 / maxSpeed + (dist - toLight) * 1.0 / maxSpeed)
			break
		t += green
	else:
		if t <= f < t + red:
			tm = toLight * 1.0 / maxSpeed
			print(t + red + (dist - toLight) * 1.0 / maxSpeed)
			break
		t += red


(l, d, v, g, r) = list(map(int, input().split()))
t1 = d / v % (g + r) - g
if t1 < 0:
	print(l / v)
else:
	print(l / v + r - t1)


from math import floor

def gt(t, g, r):
	zt = floor(t)
	rt = t - zt
	zt %= g + r
	t = zt + rt
	if t < g:
		return 0
	else:
		return r + g - t
(l, d, v, g, r) = [int(x) for x in input().split(' ')]
t = d / v
t += gt(t, g, r)
t += (l - d) / v
print(t)


(l, d, v, g, r) = map(int, input().split())
R = d / (v * (g + r))
L = (d - g * v) / (v * (g + r))
if int(R) > L:
	print(l / v)
else:
	k = int(R)
	ans = (g + r) * k + g + r + (l - d) / v
	print(ans)


(l, d, v, g, r) = map(int, input().split())
time = 0
time = d / v
curr = time % (g + r)
if curr < g:
	time += 0.0
else:
	curr = curr - g
	time += r - curr
time = time + (l - d) / v
print(time)


inp = input().split(' ')
l = int(inp[0])
d = int(inp[1])
v = int(inp[2])
g = int(inp[3])
r = int(inp[4])
n = 0
while d / v > n * (g + r):
	n += 1
n -= 1
t = d / v - n * (g + r)
if t < g:
	print(l / v)
else:
	print(d / v + r - t + g + (l - d) / v)


(a, d, v, g, r) = map(int, input().split())
if d >= a:
	print(a / v, '0')
else:
	n = d // ((g + r) * v)
	if d - n * (g + r) * v < g * v:
		print(round(a / v, 7))
	else:
		print(round((a - d + n * (r + g) * v) / v + r + g, 7))


(l, d, v, g, r) = [int(c) for c in input().split()]
light = d / v
while light >= g + r:
	light -= g + r
ret = 0.0
if light < g:
	ret = l / v
else:
	wait = g + r - light
	ret = d / v + wait + (l - d) / v
print(ret)


(l, d, v, g, r) = map(int, input().split())
t1 = d / v
if t1 % (g + r) < g:
	print(l / v)
else:
	print((g + r) * (1 + t1 // (g + r)) + (l - d) / v)


(l, d, v, g, r) = map(int, input().split())
x = (d / v / (g + r) - int(d / v / (g + r))) * (g + r)
if x < g:
	print(l / v)
elif x >= g and x < g + r:
	print(l / v + r - x + g)


(l, d, v, g, r) = input().split(' ')
l = int(l)
d = int(d)
v = int(v)
g = int(g)
r = int(r)
if d / v < g:
	print(l / v)
else:
	check = 1
	i = g
	while 1:
		if check == 1:
			i = i + r
			check = 2
		elif check == 2:
			i = i + g
			check = 1
		if i > d / v:
			break
	if check == 2:
		print(i + (l - d) / v)
	elif check == 1:
		print(l / v)


def solve(ab_dist, lights_dist, speed, green, red):
	time = lights_dist // speed
	q = time % (green + red)
	if q < green:
		time = ab_dist / speed
	else:
		time = red + green - q
		if lights_dist % speed > 0:
			time -= (red + green - q) / speed
		time += ab_dist / speed
	return time
(a, b, c, d, e) = [int(x) for x in input().split()]
print(solve(a, b, c, d, e))


(l, d, v, g, r) = map(int, input().split())
time = d / v
if time < g:
	print(l / v)
elif time == g:
	print(d / v + r - (d / v - g) + (l - d) / v)
else:
	time = d / v
	c = time % (g + r)
	if c == 0 or c < g:
		print(l / v)
	else:
		print(d / v + r - (time % (g + r) - g) + (l - d) / v)


(l, d, v, g, r) = [float(x) for x in input().strip().split()]
ttime = l / v
time1 = d / v
time1 %= g + r
if time1 < g:
	print(ttime)
else:
	print(ttime + (g + r) - time1)


(l, d, v, g, r) = map(int, input().split())
s = d / v % (g + r)
ans = l / v
if s >= g:
	ans += g + r - s
print(ans)


def before_light(l, d, v, g, r):
	min_time_to_light = d / v
	light_color = int(min_time_to_light) % (g + r)
	if light_color < g:
		return min_time_to_light
	else:
		return int(min_time_to_light / (g + r) + 1) * (g + r)

def after_light(l, d, v, g, r):
	return (l - d) / v

def solve():
	(l, d, v, g, r) = map(int, input().split())
	minimum_time = str(round(after_light(l, d, v, g, r) + before_light(l, d, v, g, r), 10))
	print(minimum_time)
solve()


(l, d, v, g, r) = map(int, input().split())
s = 0
i = 0
t = 0
while s <= d:
	if i % 2 == 0:
		if s + g * v <= d:
			t += g
			s += g * v
			i += 1
		else:
			break
	elif s + r * v <= d:
		t += r
		s += r * v
		i += 1
	else:
		t += r
		s = d
		break
print(t + (l - s) / v)


(l, d, v, g, r) = map(int, input().split())
t = l / v
test = d / v
n = 0
while test >= 0:
	if n % 2 == 0:
		test -= g
	else:
		test -= r
	n += 1
if n % 2 == 0:
	t += abs(test)
print(t)


(l, d, v, g, r) = map(int, input().split())
total_time = l / v

def next_green(time, g, r):
	start_green = 0
	end_green = g
	while True:
		if time < end_green:
			return (start_green, end_green)
		else:
			start_green = end_green + r
			end_green = start_green + g

def is_green_at_time(time, g, r):
	(start_green, end_green) = next_green(time, g, r)
	return start_green <= time < end_green
if is_green_at_time(d / v, g, r):
	print(l / v)
else:
	(start_green, end_green) = next_green(d / v, g, r)
	print(l / v + start_green - d / v)


(l, d, v, g, r) = map(int, input().split())
s = d / v % (g + r)
print(l / v + (s >= g) * (g + r - s))


(l, d, v, g, r) = list(map(int, input().split(' ')))
t_ate_sinal = d / v
d_depois_sinal = l - d
t_depois_sinal = d_depois_sinal / v
t_no_sinal = 0
resto_sinal = t_ate_sinal % (g + r)
if resto_sinal >= g:
	t_no_sinal = g - resto_sinal + r
resultado = t_ate_sinal + t_no_sinal + t_depois_sinal
print('%.8f' % resultado)


import sys
import math

def fn(l, d, v, g, r):
	t = float(d) / float(v)
	if t < g:
		return float(l) / float(v)
	elif t <= g + r:
		t = g + r
		return t + (float(l) - float(d)) / float(v)
	elif t > g + r:
		t1 = t
		k = t // (g + r)
		t = t - k * (g + r)
		if t < g:
			return float(l) / float(v)
		elif t <= g + r:
			t = g + r
			return (k + 1) * t + (float(l) - float(d)) / float(v)
input = sys.stdin.read()
data = list(map(int, input.split()))
l = data[0]
d = data[1]
v = data[2]
g = data[3]
r = data[4]
print(fn(l, d, v, g, r))


(l, d, v, g, r) = map(int, input().split())
t = l / v
t1 = d / v
k = [[0, g, 'g']]
for i in range(1, 2000):
	if i % 2 == 0:
		k.append([k[i - 1][1], k[i - 1][1] + g, 'g'])
	else:
		k.append([k[i - 1][1], k[i - 1][1] + r, 'r'])
for j in k:
	(a, b, c) = j
	if a <= t1 < b:
		if c == 'g':
			print(t)
			break
		else:
			print(t1 + abs(b - t1) + (l - d) / v)
			break


(l, d, v, g, r) = map(int, input().split())
t = l / v
t1 = d / v
i = g
while i <= t1:
	i += r
	if i > t1:
		t += i - t1
	i += g
print(t)


(l, d, v, g, r) = map(int, input().split())
t1 = d / v
slot = t1 // (r + g)
t1 = t1 - slot * (r + g)
if t1 < g:
	wait = 0
elif t1 == r + g:
	wait = 0
else:
	wait = r + g - t1
total = wait + l / v
print('%.8f' % total)


(l, d, v, g, r) = map(int, input().split())
seconds_to_traffic_light = d / v
seconds_to_final_point = (l - d) / v

def get_waiting_time(t, g, r):
	while t > g + r:
		t -= g + r
	if t < g:
		return 0
	return g + r - t
waiting_time = get_waiting_time(seconds_to_traffic_light, g, r)
answer = seconds_to_traffic_light + waiting_time + seconds_to_final_point
print('%.9f' % answer)


(l, d, v, g, r) = map(int, input().split())
t = d / v
ft = t % (g + r)
if ft >= g:
	t += r - (ft - g)
t += (l - d) / v
print(t)


import sys

def solve():
	(l, d, v, g, r) = rv()
	timetotraffic = d / v
	loops = timetotraffic // (g + r)
	extratime = timetotraffic - (g + r) * loops
	if extratime >= g:
		timetotraffic = (g + r) * (loops + 1)
	moretime = (l - d) / v
	print(timetotraffic + moretime)

def prt(l):
	return print(''.join(l))

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

def rl(n):
	return [list(map(int, input().split())) for _ in range(n)]
if sys.hexversion == 50594544:
	sys.stdin = open('test.txt')
solve()


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
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 binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac
(l, d, v, g, r) = map(int, input().split())
t1 = d // v
if t1 % (g + r) < g:
	ttl = l / v
else:
	ttd = d // v
	dif = d / v - ttd
	ttl = d / v + g + r - d // v % (g + r)
	ttl -= dif
	ttl += (l - d) / v
print(ttl)


(l, d, v, g, r) = map(int, input().split())
b = d / v
t = b % (g + r)
if t < g:
	print(b + (l - d) / v)
else:
	print(b - t + g + r + (l - d) / v)


def solve():
	(l, d, v, g, r) = [int(x) for x in input().split(' ')]
	t = d / v
	x = t % (g + r)
	if x >= g:
		t += g + r - x
	t += (l - d) / v
	return t
print(solve())


s = input().split()
AB = int(s[0])
d = int(s[1])
V = int(s[2])
g = int(s[3])
r = int(s[4])
if g < d / V < g + r:
	print(d / V + (AB - d) / V + r - (d / V - g))
else:
	s = d / V % (g + r)
	if s == 0 or s < g:
		print(d / V + (AB - d) / V)
	else:
		print(d / V + (AB - d) / V + r)


(l, d, v, g, r) = map(int, input().split())
t = d / v
if g > t:
	print(t + (l - d) / v)
elif t < g + r:
	if t > g:
		w = r - t + g
		print(w + t + (l - d) / v)
	else:
		w = r - t % g
		print(w + t + (l - d) / v)
else:
	s = g + r
	while s <= t:
		s += g + r
	s -= g + r
	if t < s + g:
		print(t + (l - d) / v)
	else:
		w = r - (s + g) % r
		print(t + w + (l - d) / v)


import math
(l, d, v, g, r) = [int(c) for c in input().split()]
ts = d / v
te = (l - d) / v
pos = ts % (g + r)
if pos == 0:
	print(te + ts)
elif ts >= math.floor(ts / (g + r)) * (g + r) + g:
	print(math.ceil(ts / (g + r)) * (g + r) + te)
else:
	print(te + ts)


(l, d, v, g, r) = map(int, input().split())
t = d / v
y = t % (g + r)
if y < g:
	wt = 0
else:
	wt = g + r - y
tt = t + wt + (l - d) / v
print(tt)


(l, d, v, g, r) = map(int, input().split())
x = d / v % (g + r)
if x < g:
	print(l / v)
else:
	print(d / v + abs(x - (g + r)) + (l - d) / v)


def cf29B():
	from sys import stdin, stdout
	(l, d, v, g, r) = map(int, stdin.readline().split())
	t = 0
	t += d / v
	cycle = g + r
	rem = t
	while rem > cycle:
		rem -= cycle
	if rem >= g:
		rem -= g
		t += r - rem
	t += (l - d) / v
	stdout.write('{0:.6f}\n'.format(t))
cf29B()


(l, d, v, g, r) = map(int, input().split())
t = d / v
c = 0
i1 = 0
i2 = g
while not (i1 <= t and i2 >= t):
	c += 1
	if c % 2 != 0:
		i1 = i2
		i2 = i2 + r
	else:
		i1 = i2
		i2 = i2 + g
if i1 == t or i2 == t:
	c += 1
if c % 2 != 0 and (i1 == t or i2 == t):
	t = i2 + r
elif c % 2 != 0:
	t = i2
t += (l - d) / v
print(t)


(l, d, v, g, r) = map(int, input().split())
time_to_lights = d / v
time_at_lights = 0
if time_to_lights % (g + r) >= g:
	time_at_lights = g + r - time_to_lights % (g + r)
time_after_lights = (l - d) / v
print(time_to_lights + time_at_lights + time_after_lights)


import sys
from array import array

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
(l, d, v, g, r) = map(int, input().split())
eps = 1e-09
t1 = d / v
if (t1 + eps) % (g + r) > g:
	t1 = ((t1 + eps) // (g + r) + 1) * (g + r)
t2 = (l - d) / v
print(t1 + t2)


def fmod(x, m):
	while x >= m:
		x = x - m
	return x
(l, d, v, g, r) = map(int, input().split(' '))
x = fmod(float(d / v), g + r)
ans = d / v + (l - d) / v
if x >= g:
	ans = ans + g + r - x
print('%.10f' % ans)


(l, d, v, g, r) = map(int, input().split())
m = d / v % (g + r)
print(l / v + (m >= g) * (r + g - m))