def efficient(v,a,w,d):
    if 2*v*v-w*w<=2*a*d:
        t1=v/a
        t2=(v-w)/a
        t3=(d-0.5*a*t1*t1-v*t2+0.5*a*t2*t2)/v
        return t1+t2+t3
    else:
        bound=((2*a*d+w*w)/2)**0.5
        t1=bound/a
        t2=(bound-w)/a
        return t1+t2
def func(u,v,a,l):
    if (v**2-u**2)>=2*a*l:
        return ((u**2+2*a*l)**(1/2)-u)/a
    else:
        t1=(v-u)/a
        t2=(l-(u*t1+a*t1*t1/2))/v
        return t1+t2
def main():
    string1=input()
    string2=input()
    arr1=string1.split(" ")
    arr2=string2.split(" ")
    a=int(arr1[0])
    v=int(arr1[1])
    l=int(arr2[0])
    d=int(arr2[1])
    w=int(arr2[2])
    if v<=w:
        t1=func(0,v,a,l)
        print("%.8f"%(t1))
    else:
        t1=efficient(v,a,w,d)
        t2=func(w,v,a,l-d)
        print("%.8f"%(t1+t2))
main()


def func(u,v,a,l):
    if (v**2-u**2)>=2*a*l:
        return ((u**2+2*a*l)**(1/2)-u)/a
    else:
        t1=(v-u)/a
        t2=(l-(u*t1+a*t1*t1/2))/v
        return t1+t2
def efficient(v,a,w,d):
    if 2*v*v-w*w<=2*a*d:
        t1=v/a
        t2=(v-w)/a
        t3=(d-0.5*a*t1*t1-v*t2+0.5*a*t2*t2)/v
        return t1+t2+t3
    else:
        bound=((2*a*d+w*w)/2)**0.5
        t1=bound/a
        t2=(bound-w)/a
        t3=func(0,w,a,d)
        return t1+t2
        return min(t1+t2,t3)
def main():
    string1=input()
    string2=input()
    arr1=string1.split(" ")
    arr2=string2.split(" ")
    a=int(arr1[0])
    v=int(arr1[1])
    l=int(arr2[0])
    d=int(arr2[1])
    w=int(arr2[2])
    if 2*a*d<=w**2:
        t1=func(0,v,a,l)
        print("%.8f"%(t1))
    else:
        t1=efficient(v,a,w,d)
        t2=func(w,v,a,l-d)
        print("%.8f"%(t1+t2))
main()


# -*-coding:utf-8 -*-
import math
a,v=map(float,input().split())
l,d,w=map(float,input().split())
ans=0
if v<w:
    t0=v/float(a)
    t1=(l-(a*t0**2)/2.0)/float(v)
    ans=t0+t1
elif a*math.sqrt(2.0*d/a)<w:
    t0=v/float(a)
    l1=(a*t0**2)/2
    if l1>=l:
        ans=math.sqrt(2.0*l/a)
    else:
        t1=(l-l1)/float(v)
        ans=t0+t1
else:
    t0=(-3*w+math.sqrt(5*w**2+8*a*d))/(2*a)
    t1=(w+a*t0)/float(a)
    t2=(v-w)/float(a)
    if ((w+a*t1)/2)*t1<(l-d):
        t3=((l-d)-(((w+a*t1)/2)*t1))/float(v)
        ans=t0+t1+t2+t3
    else:
        t2=((-w)+math.sqrt(w**2+8*a*(l-d)))/(2*a)
        ans=t0+t1+t2
print(ans)


# -*-coding:utf-8 -*-
import math
a,v=map(float,input().split())
l,d,w=map(float,input().split())
ans=0
if v<w:
    t0=v/float(a)
    t1=(l-(a*t0**2)/2.0)/float(v)
    ans=t0+t1
elif a*math.sqrt(2.0*d/a)<w:
    t0=v/float(a)
    l1=(a*t0**2)/2
    if l1>=l:
        ans=math.sqrt(2.0*l/a)
    else:
        t1=(l-l1)/float(v)
        ans=t0+t1
else:
    t0=w/a
    t1=(d-(a*t0**2)/2)/w
    t2=(v-w)/a
    if (w*t2+(a*(t2**2))/2)>(l-d):
        t2=(-w+math.sqrt(math.pow(w,2)-2*a*(d-l)))/a
        ans=t0+t1+t2
    else:
        t3=(l-d-(w*t2+(a*(t2**2))/2))/v
        ans=t0+t1+t2+t3
print(ans)


# -*-coding:utf-8 -*-
import math
a,v=map(float,input().split())
l,d,w=map(float,input().split())
ans=0
if v<w:
    t0=v/float(a)
    t1=(l-(a*t0**2)/2.0)/float(v)
    ans=t0+t1
elif a*math.sqrt(2.0*d/a)<w:
    t0=v/float(a)
    l1=(a*t0**2)/2
    if l1>=l:
        ans=math.sqrt(2.0*l/a)
    else:
        t1=(l-l1)/float(v)
        ans=t0+t1
else:
    t0=math.sqrt((d+pow(w,2)/(2*a))/a)
    if a*t0<v:
        t1=t0-w/a
    else:
        t0=v/a
        t1=(v-w)/a
        t1+=(d-a*pow(t0,2)/2-v*t1+a*pow(t1,2)/2)/v
    t2=(v-w)/a
    if (w*t2+(a*(t2**2))/2)>(l-d):
        t2=(-w+math.sqrt(math.pow(w,2)-2*a*(d-l)))/a
        ans=t0+t1+t2
    else:
        t3=(l-d-(w*t2+(a*(t2**2))/2))/v
        ans=t0+t1+t2+t3
print(ans)


# -*-coding:utf-8 -*-
import math
a,v=map(float,input().split())
l,d,w=map(float,input().split())
ans=0
if v<w:
    t0=v/float(a)
    if a*pow(t0,2)/2>l:
        ans=math.sqrt(2*l/a)
    else:
        t1=(l-(a*t0**2)/2.0)/float(v)
        ans=t0+t1
elif a*math.sqrt(2.0*d/a)<w:
    t0=v/a
    l1=(a*t0**2)/2
    if l1>=l:
        ans=math.sqrt(2.0*l/a)
    else:
        t1=(l-l1)/float(v)
        ans=t0+t1
else:
    t0=math.sqrt((d+pow(w,2)/(2*a))/a)
    if a*t0<v:
        t1=t0-w/a
    else:
        t0=v/a
        t1=(v-w)/a
        t1+=(d-a*pow(t0,2)/2-v*t1+a*pow(t1,2)/2)/v
    t2=(v-w)/a
    if (w*t2+(a*(t2**2))/2)>(l-d):
        t2=(-w+math.sqrt(math.pow(w,2)-2*a*(d-l)))/a
        ans=t0+t1+t2
    else:
        t3=(l-d-(w*t2+(a*(t2**2))/2))/v
        ans=t0+t1+t2+t3
print(ans)


# -*-coding:utf-8 -*-
import math
a,v=map(float,input().split())
l,d,w=map(float,input().split())
ans=0
if v<w:
    t0=v/float(a)
    t1=(l-(a*t0**2)/2.0)/float(v)
    ans=t0+t1
elif a*math.sqrt(2.0*d/a)<w:
    t0=v/float(a)
    l1=(a*t0**2)/2
    if l1>=l:
        ans=math.sqrt(2.0*l/a)
    else:
        t1=(l-l1)/float(v)
        ans=t0+t1
else:
    t0=w/a
    t1=(d-(a*t0**2)/2)/w
    t2=(v-w)/a
    if (w*t2+(a*(t2**2))/2)>(l-d):
        t2=(-w+math.sqrt(math.pow(w,2)-2*a*(d-l)))/a
        print(t0, t1, t2)
        ans=t0+t1+t2
    else:
        t3=(l-d-(w*t2+(a*(t2**2))/2))/v
        ans=t0+t1+t2+t3
print(ans)


from math import sqrt
import sys
from typing import List, Union

def rl(int_: bool = True, is_split: bool = True) -> Union[List[str], List[int]]:
    if int_:
        return [int(w) for w in sys.stdin.readline().split()]
    if is_split:
        return [w for w in sys.stdin.readline().split()]
    return sys.stdin.readline().strip()

a, v = rl()
l, d, w = rl()

def time(u, s, a, v):
    vs = sqrt(u * u + 2 * a * s)
    # print("vs", vs)
    if vs <= v:
        return (vs - u) / a
    elif vs > v:
        dv = (v * v - u * u) / (2 * a)
        # print("dv", dv)
        if dv >= s:
            vd = sqrt(u * u + 2 * a * s)
            # print(vd)
            return (vd - u) / a
        else:
            return ((v - u) / a) + ((s - dv) / v)

if w >= v:
    print(time(0, l, a, v))
elif w < v:
    vd = sqrt(2 * a * d)
    # print("vd", vd)
    if vd <= w:
        print(time(0, l, a, v))
    elif vd > w:
        v_ = sqrt((w * w + 2 * a * d) / 2)
        # print(v_)
        if v_ <= v:
            td = (v_ / a) + ((v_ - w) / a)
        elif v_ > v:
            td = (v / a) + ((d - ((2 * v * v - w * w) / (2 * a))) / v) + ((v - w) / a)

        print(td + time(w, l - d, a, v))


from math import sqrt
import sys
from typing import List, Union

def rl(int_: bool = True, is_split: bool = True) -> Union[List[str], List[int]]:
    if int_:
        return [int(w) for w in sys.stdin.readline().split()]
    if is_split:
        return [w for w in sys.stdin.readline().split()]
    return sys.stdin.readline().strip()

a, v = rl()
l, d, w = rl()

def time(u, s, a, v):
    vs = sqrt(u * u + 2 * a * s)
    # print("vs", vs)
    if vs <= v:
        return (vs - u) / a
    elif vs > v:
        dv = (v * v - u * u) / (2 * a)
        # print("dv", dv)
        if dv >= s:
            vd = sqrt(u * u + 2 * a * s)
            # print(vd)
            return (vd - u) / a
        else:
            return ((v - u) / a) + ((s - dv) / v)

if w >= v:
    print(time(0, l, a, v))
elif w < v:
    vd = sqrt(2 * a * d)
    # print("vd", vd)
    if vd <= w:
        print(time(0, l, a, v))
    elif vd > w:
        v_ = sqrt((w * w + 2 * a * d) / 2)
        # print(v_)
        if v_ <= v:
            td = (v_ / a) + ((v_ - w) / a)
        elif v_ > v:
            td = (v / a) + ((d - ((2 * v * v - w * w) / 2 * a)) / v) + ((v - w) / a)

        print(td + time(w, l - d, a, v))


from math import sqrt
import sys
from typing import List, Union

def rl(int_: bool = True, is_split: bool = True) -> Union[List[str], List[int]]:
    if int_:
        return [int(w) for w in sys.stdin.readline().split()]
    if is_split:
        return [w for w in sys.stdin.readline().split()]
    return sys.stdin.readline().strip()

a, v = rl()
l, d, w = rl()

def time(u, s, a, v):
    f = sqrt(u * u + 2 * a * s)
    if f <= v:
        return (f - u) / a
    elif f > v:
        dv = (v * v - u * u) / 2 * a
        return ((v - u) / a) + ((s - dv) / v)

if w >= v:
    print(time(0, l, a, v))
elif w < v:
    vd = sqrt(2 * a * d)
    if vd <= w:
        print(time(0, l, a, v))
    elif vd > w:
        v_ = sqrt((w * w + 2 * a * d) / 2)
        if v_ <= v:
            print((v_ / a) + ((v_ - w) / a) + time(w, l - d, a, v))
        elif v_ > v:
            print(
                (v / a)
                + ((d - ((2 * v * v - w * w) / 2 * a)) / v)
                + ((v - w) / a)
                + time(w, l - d, a, v)
            )


from math import sqrt
import sys
from typing import List, Union

def rl(int_: bool = True, is_split: bool = True) -> Union[List[str], List[int]]:
    if int_:
        return [int(w) for w in sys.stdin.readline().split()]
    if is_split:
        return [w for w in sys.stdin.readline().split()]
    return sys.stdin.readline().strip()

a, v = rl()
l, d, w = rl()

def time(u, s, a, v):
    f = sqrt(u * u + 2 * a * s)
    if f <= v:
        return (f - u) / a
    elif f > v:
        dv = (v * v - u * u) / 2 * a
        return ((v - u) / a) + ((s - dv) / v)

if w >= v:
    print(time(0, l, a, v))
elif w < v:
    vd = sqrt(2 * a * d)
    if vd <= w:
        print(time(0, l, a, v))
    elif vd > w:
        v_ = sqrt((w * w + 2 * a * d) / 2)
        if v_ <= v:
            td = (v_ / a) + ((v_ - w) / a)
        elif v_ > v:
            td = (v / a) + ((d - ((2 * v * v - w * w) / 2 * a)) / v) + ((v - w) / a)

        print(td + time(w, l - d, a, v))


#!/usr/bin/env python

from sys import stdin
from math import sqrt

EPS = 1e-9

def position_at_time(t, acceletarion, initial_speed, initial_position):
   return 0.5*acceletarion*t*t + initial_speed*t + initial_position

def time_to_reach_speed(final_speed, initial_speed, acceletarion):
   return abs(float(final_speed - initial_speed)) / acceletarion

def time_to_travel_distance(distance_to_travel, initial_speed, acceletarion):
   return ( -initial_speed +
            sqrt(initial_speed*initial_speed + 2*acceletarion*distance_to_travel)
          ) / acceletarion

a, v = map(int, stdin.readline().split())
l, d, w = map(int, stdin.readline().split())

res = 0.0

vd = w

if w >= v:
   t0 = time_to_reach_speed(v, 0, a)
   x0 = position_at_time(t0, a, 0, 0)
   if x0 >= d - EPS:
      res += time_to_travel_distance(d, 0, a)
      vd = a*t0
   else:
      res += t0 + (d - x0)/v
      vd = v
else:
   t4 = time_to_reach_speed(w, 0, a)
   x4 = position_at_time(t4, a, 0, 0)
   if x4 >= d - EPS:
      res += time_to_travel_distance(d, 0, a)
      vd = a*t4
   else:
      t6 = time_to_reach_speed(v, 0, a)
      d6 = position_at_time(t6, a, 0, 0)
      t7 = time_to_reach_speed(v, w, a)
      d7 = position_at_time(t7, a, w, 0)
      if d6 + d7 <= d + EPS:
         res = t6 + (d - d6 - d7) / v + t7
      else:
         lo = w
         hi = v
         for tt in range(80):
            mid = (lo + hi)/2.0
            t5 = time_to_reach_speed(mid, 0, a)
            d5 = position_at_time(t5, a, 0, 0)
            t3 = time_to_reach_speed(mid, w, a)
            d3 = position_at_time(t3, -a, mid, 0)
         #  print "%.5f  %.5f  %.5f  %.5f + %.5f  %.5f + %.5f" % (lo, hi, mid, d5, d3, t5, t3)
            if d5 + d3 > d + EPS:
               hi = mid
            else:
               lo = mid
            res = time_to_reach_speed(lo, 0, a) + time_to_reach_speed(lo, w, a)
      vd = w

t1 = time_to_reach_speed(v, vd, a)
x1 = position_at_time(t1, a, vd, d)
if x1 >= l - EPS:
   res += time_to_travel_distance(l-d, vd, a)
else:
   res += t1 + (l - x1)/v

print("%.10f\n" % (res))


#!/usr/bin/env python

from sys import stdin
from math import sqrt

EPS = 1e-9

def position_at_time(t, acceletarion, initial_speed, initial_position):
   return 0.5*acceletarion*t*t + initial_speed*t + initial_position

def time_to_reach_speed(final_speed, initial_speed, acceletarion):
   return abs(float(final_speed - initial_speed)) / acceletarion

def time_to_travel_distance(distance_to_travel, initial_speed, acceletarion):
   return ( -initial_speed +
            sqrt(initial_speed*initial_speed + 2*acceletarion*distance_to_travel)
          ) / acceletarion

#
# Main
#

a, v = map(int, stdin.readline().split())
l, d, w = map(int, stdin.readline().split())

res = 0.0

vd = w

if w >= v:
   t0 = time_to_reach_speed(v, 0, a)
   x0 = position_at_time(t0, a, 0, 0)
   if x0 >= d - EPS:
      res += time_to_travel_distance(d, 0, a)
      vd = a*t0
   else:
      res += t0 + (d - x0)/v
      vd = v
else:
   t4 = time_to_reach_speed(w, 0, a)
   x4 = position_at_time(t4, a, 0, 0)
   if x4 >= d - EPS:
      t8 = time_to_travel_distance(d, 0, a)
      res += t8
      vd = a*t8
   else:
      t6 = time_to_reach_speed(v, 0, a)
      d6 = position_at_time(t6, a, 0, 0)
      t7 = time_to_reach_speed(v, w, a)
      d7 = position_at_time(t7, a, w, 0)
      if d6 + d7 <= d + EPS:
         res = t6 + (d - d6 - d7) / v + t7
      else:
         lo = w
         hi = v
         for tt in range(80):
            mid = (lo + hi)/2.0
            t5 = time_to_reach_speed(mid, 0, a)
            d5 = position_at_time(t5, a, 0, 0)
            t3 = time_to_reach_speed(mid, w, a)
            d3 = position_at_time(t3, -a, mid, 0)
         #  print "%.5f  %.5f  %.5f  %.5f + %.5f  %.5f + %.5f" % (lo, hi, mid, d5, d3, t5, t3)
            if d5 + d3 > d + EPS:
               hi = mid
            else:
               lo = mid
         res = time_to_reach_speed(lo, 0, a) + time_to_reach_speed(lo, w, a)
      vd = w

t1 = time_to_reach_speed(v, vd, a)
x1 = position_at_time(t1, a, vd, d)

if x1 >= l - EPS:
   res += time_to_travel_distance(l-d, vd, a)
else:
   res += t1 + (l - x1)/v

print("%.12f" % (res))


#!/usr/bin/env python

from sys import stdin, stderr
from math import sqrt

EPS = 1e-9

def position_at_time(t, acceletarion, initial_speed, initial_position):
   return 0.5*acceletarion*t*t + initial_speed*t + initial_position

def time_to_reach_speed(final_speed, initial_speed, acceletarion):
   return abs(float(final_speed - initial_speed)) / acceletarion

def time_to_travel_distance(distance_to_travel, initial_speed, acceletarion):
   return ( -initial_speed +
            sqrt(initial_speed*initial_speed + 2*acceletarion*distance_to_travel)
          ) / acceletarion

#
# Main
#

a, v = map(int, stdin.readline().split())
l, d, w = map(int, stdin.readline().split())

res = 0.0

vd = w

if w >= v:
   t = time_to_reach_speed(v, 0, a)
   x = position_at_time(t, a, 0, 0)
   if x >= d - EPS:
      t = time_to_travel_distance(d, 0, a)
      res += t
      vd = a*t
   else:
      res += t + (d - x)/v
      vd = v
else:
   t = time_to_reach_speed(w, 0, a)
   x = position_at_time(t, a, 0, 0)
   if x >= d - EPS:
      t = time_to_travel_distance(d, 0, a)
      res += t
      vd = a*t
   else:
      ts = time_to_reach_speed(v, 0, a)
      ds = position_at_time(ts, a, 0, 0)
      tf = time_to_reach_speed(v, w, a)
      df = position_at_time(tf, a, w, 0)
      if ds + df <= d + EPS:
         res = ts + (d - ds - df) / v + tf
      else:
         lo = w
         hi = v
         for tt in range(80):
            mid = (lo + hi)/2.0
            ts = time_to_reach_speed(mid, 0, a)
            ds = position_at_time(ts, a, 0, 0)
            tf = time_to_reach_speed(mid, w, a)
            df = position_at_time(tf, -a, mid, 0)
            if ds + df > d + EPS:
               hi = mid
            else:
               lo = mid
         res = time_to_reach_speed(lo, 0, a) + time_to_reach_speed(lo, w, a)
      vd = w

t = time_to_reach_speed(v, vd, a)
x = position_at_time(t, a, vd, d)

if x >= l - EPS:
   res += time_to_travel_distance(l-d, vd, a)
else:
   res += t + (l - x)/v

print("%.12f" % (res))


import math

line = [float(x) for x in input().split()]

a = line[0]
v = line[1]

line = [float(x) for x in input().split()]

l = line[0]
d = line[1]
w = line[2]

# - - - - -

t_to_top_speed = v/a
t_to_target = math.sqrt(2.0*l/a)

if w >= v:
	if t_to_target <= t_to_top_speed:
		print(t_to_target)
	else:
		partial_distance = v*v/(2.0*a)
		print(t_to_top_speed + (l - partial_distance)/v)
else:
	t_before_sign = 0.0
	if w*w - 2.0*v*w - v*v + 4.0*d*a <= 0:
		t_to_w = w/a
		t_to_speed_sign = math.sqrt(2*w*w/(a*a) + 4*d/a) - 2*w/a
		t_before_sign = t_to_w + t_to_speed_sign
	else:
		t_with_v = (d - v*v/a + w*w/(2.0*a))/v
		t_to_v = v/a
		t_to_deacc = (v-w)/a
		t_before_sign = t_to_v + t_with_v + t_to_deacc

	t_after_sign = math.sqrt(w*w/(a*a) + 2.0*(l-d)/a)-w/a
	print(t_before_sign + t_after_sign)


import math

line = [float(x) for x in input().split()]

a = line[0]
v = line[1]

line = [float(x) for x in input().split()]

l = line[0]
d = line[1]
w = line[2]

# - - - - -

t_to_top_speed = v/a
t_to_target = math.sqrt(2.0*l/a)
t_to_speed_sign = math.sqrt(2.0*d/a)

if w >= v or t_to_speed_sign <= w/a:
	if t_to_target <= t_to_top_speed:
		print(t_to_target)
	else:
		partial_distance = v*v/(2.0*a)
		print(t_to_top_speed + (l - partial_distance)/v)
else:
	t_before_sign = 0.0
	t_to_speed_sign = math.sqrt(2*w*w/(a*a) + 4*d/a) - 2*w/a

	if t_to_speed_sign <= 2.0 * (v-w)/a:
		t_to_w = w/a
		t_before_sign = t_to_w + t_to_speed_sign
	else:
		t_with_v = (d - v*v/a + w*w/(2.0*a))/v
		t_to_v = v/a
		t_to_deacc = (v-w)/a
		t_before_sign = t_to_v + t_with_v + t_to_deacc

	t_after_sign = math.sqrt(w*w/(a*a) + 2.0*(l-d)/a)-w/a
	print(t_before_sign + t_after_sign)


import math

line = [float(x) for x in input().split()]

a = line[0]
v = line[1]

line = [float(x) for x in input().split()]

l = line[0]
d = line[1]
w = line[2]

# - - - - -

t_to_top_speed = v/a
t_to_target = math.sqrt(2.0*l/a)
t_to_speed_sign = math.sqrt(2.0*d/a)

if w >= v or t_to_speed_sign <= w/a:
	if t_to_target <= t_to_top_speed:
		print(t_to_target)
	else:
		partial_distance = v*v/(2.0*a)
		print(t_to_top_speed + (l - partial_distance)/v)
else:
	t_before_sign = 0.0
	t_to_speed_sign = math.sqrt(2*w*w/(a*a) + 4*d/a) - 2*w/a

	if t_to_speed_sign <= 2.0 * (v-w)/a:
		t_to_w = w/a
		t_before_sign = t_to_w + t_to_speed_sign
	else:
		t_with_v = (d - v*v/a + w*w/(2.0*a))/v
		t_to_v = v/a
		t_to_deacc = (v-w)/a
		t_before_sign = t_to_v + t_with_v + t_to_deacc

	t_to_target = math.sqrt(w*w/(a*a) + 2.0*(l-d)/a)-w/a
	t_to_v = (v-w)/a

	if t_to_v >= t_to_target:
		t_after_sign = t_to_target
	else:
		partial_distance = d + (v*v - w*w)/(2.0*a)
		t_final = (l - partial_distance)/v
		t_after_sign = t_to_v + t_final

	print(t_before_sign + t_after_sign)


import math

line = [float(x) for x in input().split()]

a = line[0]
v = line[1]

line = [float(x) for x in input().split()]

l = line[0]
d = line[1]
w = line[2]

# - - - - -

t_to_top_speed = v/a
t_to_target = math.sqrt(2.0*l/a)

if w >= v:
	if t_to_target <= t_to_top_speed:
		print(t_to_target)
	else:
		partial_distance = v*v/(2.0*a)
		print(t_to_top_speed + (l - partial_distance)/v)
else:
	t_before_sign = 0.0
	if w*w <= 2*v*v - d*a:
		t_to_w = w/a
		t_to_speed_sign = math.sqrt(2*w*w/(a*a) + 4*d/a) - 2*w/a
		t_before_sign = t_to_w + t_to_speed_sign
	else:
		t_with_v = (d - v*v/a + w*w/(2.0*a))/v
		t_to_v = v/a
		t_to_deacc = (v-w)/a
		t_before_sign = t_to_v + t_with_v + t_to_deacc

	t_after_sign = math.sqrt(w*w/(a*a) + 2.0*(l-d)/a)-w/a
	print(t_before_sign + t_after_sign)


import math

a, v = map(float, input().split())
l, d, w = map(float, input().split())

res = 0.0
if v <= w:
    t1 = v / a
    d1 = 0.5*a*t1*t1
    if d1 >= l:
        res = math.sqrt(l*2/a)
    else:
        t2 = (l - d1) / v
        res = t1 + t2
else:
    t1 = w / a
    d1 = 0.5*a*t1*t1
    if d1 >= d:
        t1 = math.sqrt(d*2/a)
        cur = t1 * a
        t2 = (v - cur) / a
        d2 = 0.5*a*t2*t2 + cur*t2
        if d2 >= l - d:
            res = math.sqrt(l*2/a)
        else:
            t1 = v / a
            t2 = (l - 0.5*a*t1*t1) / v
            res = t1 + t2
    else:
        t1 = w / a
        t2 = (d - 0.5*a*t1*t1) / w
        t3 = (v - w) / a
        d3 = 0.5*a*t3*t3 + w*t3
        if d3 >= l - d:
            t3 = (-w + math.sqrt(w*w - 4*0.5*a*(-(l-d)))) / a
            res = t1 + t2 + t3
        else:
            t3 = (v - w) / a
            d3 = 0.5 * a * t3 * t3 + w * t3
            t4 = (l - d3) / v
            res = t1 + t2 + t3 + t4

print(res)


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())

    #v*v = 2*a*s1
    #v*v - w*w = 2*a*s2
    #if s1+s2<=d
    #The car can reach v before passing the speed sign
    #Otherwise, the car can't reach v before passing the speed sign
    if v*v/(2*a) + (v*v-w*w)/(2*a) <= d and v >= w:
        t1=v/a
        s1=v*v/(2*a)
        t3=(v-w)/a
        s3=(v*v-w*w)/(2*a)
        s2=d-s1-s3
        t2=s2/v
        s4=l-s1-s2-s3
        if (v*v-w*w)/(2*a) >= s4:
            t4=(sqrt(2*a*s4+w*w)-w)/a
            t=t1+t2+t3+t4
        else:
            t5=(v-w)/a
            s5=(v*v-w*w)/(2*a)
            s6=s4-s5
            t6=s6/v
            t=t1+t2+t3+t5+t6
    #The car can't reach v before passing the speed sign
    else:
        #Don't have to decelerate before the speed sign
        if w*w/(2*a) >= d:
            if v*v/(2*a) >= l:
                t=sqrt(2*l/a)
            else:
                t1=v/a
                t2=(l-v*v/(2*a))/v
                t=t1+t2
        #Have to decelerate before the speed sign
        #the maximum speed is u (u<v)
        #u*u = 2*a*s1
        #u*u - w*w = 2*a*s2
        #s1 + s2 = d
        else:
            s1=(2*a*d+w*w)/(4*a)
            s2=(2*a*d-w*w)/(4*a)
            s3=l-s1-s2
            t1=sqrt((2*s1)/a)
            t2=t1-w/a
            if (v*v-w*w)/(2*a) >= s3:
                t3=(sqrt(2*a*s3+w*w)-w)/a
                t=t1+t2+t3
            else:
                t4=(v-w)/a
                s4=(v*v-w*w)/(2*a)
                s5=s3-s4
                t5=s5/v
                t=t1+t2+t4+t5
    print(t)
    return

CF_5D()


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())
    #Don't have to decelerate before the speed sign
    if w*w/(2*a) >= d:
        if v*v/(2*a) >= l:
            t=sqrt(2*l/a)
        else:
            t1=v/a
            t2=(l-v*v/(2*a))/v
            t=t1+t2
    #Have to decelerate before the speed sign
    #u*u = 2*a*s1
    #u*u - w*w = 2*a*s2
    #s1 + s2 = d
    else:
        s1=(2*a*d+w*w)/(4*a)
        s2=(2*a*d-w*w)/(4*a)
        s3=l-s1-s2
        t1=sqrt((2*s1)/a)
        t2=t1-w/a
        if (v*v-w*w)/(2*a) >= s3:
            t3=(sqrt(2*a*s3+w*w)-w)/a
            t=t1+t2+t3
        else:
            t4=(v-w)/a
            s4=(v*v*v-w*w)/(2*a)
            s5=s3-s4
            t5=s5/v
            t=t1+t2+t4+t5
    print(t)
    return

CF_5D()


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())
    #The car can reach v before passing the speed sign
    if v*v/(2*a) >= l:
        t1=v/a
        s1=v*v/(2*a)
        t3=(v-w)/a
        s3=(v*v-w*w)/(2*a)
        s2=d-s1-s3
        t2=s2/v
        s4=l-s1-s2-s3
        if (v*v-w*w)/(2*a) >= s4:
            t4=(sqrt(2*a*s4+w*w)-w)/a
            t=t1+t2+t3+t4
        else:
            t5=(v-w)/a
            s5=(v*v-w*w)/(2*a)
            s6=s4-s5
            t6=s6/v
            t=t1+t2+t3+t5+t6
    #The car can't reach v before passing the speed sign
    else:
        #Don't have to decelerate before the speed sign
        if w*w/(2*a) >= d:
            if v*v/(2*a) >= l:
                t=sqrt(2*l/a)
            else:
                t1=v/a
                t2=(l-v*v/(2*a))/v
                t=t1+t2
        #Have to decelerate before the speed sign
        #u*u = 2*a*s1
        #u*u - w*w = 2*a*s2
        #s1 + s2 = d
        else:
            s1=(2*a*d+w*w)/(4*a)
            s2=(2*a*d-w*w)/(4*a)
            s3=l-s1-s2
            t1=sqrt((2*s1)/a)
            t2=t1-w/a
            if (v*v-w*w)/(2*a) >= s3:
                t3=(sqrt(2*a*s3+w*w)-w)/a
                t=t1+t2+t3
            else:
                t4=(v-w)/a
                s4=(v*v-w*w)/(2*a)
                s5=s3-s4
                t5=s5/v
                t=t1+t2+t4+t5
    print(t)
    return

CF_5D()


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())

    #v*v = 2*a*s1
    #v*v - w*w = 2*a*s2
    #if s1+s2<=d
    #The car can reach v before passing the speed sign
    #Otherwise, the car can't reach v before passing the speed sign
    if v*v/(2*a)+(v*v-w*w)/(2*a)<=d:
        t1=v/a
        s1=v*v/(2*a)
        t3=(v-w)/a
        s3=(v*v-w*w)/(2*a)
        s2=d-s1-s3
        t2=s2/v
        s4=l-s1-s2-s3
        if (v*v-w*w)/(2*a) >= s4:
            t4=(sqrt(2*a*s4+w*w)-w)/a
            t=t1+t2+t3+t4
            print(1)
        else:
            t5=(v-w)/a
            s5=(v*v-w*w)/(2*a)
            s6=s4-s5
            t6=s6/v
            t=t1+t2+t3+t5+t6
            print(2)
    #The car can't reach v before passing the speed sign
    else:
        #Don't have to decelerate before the speed sign
        if w*w/(2*a) >= d:
            if v*v/(2*a) >= l:
                t=sqrt(2*l/a)
                print(3)
            else:
                t1=v/a
                t2=(l-v*v/(2*a))/v
                t=t1+t2
                print(4)
        #Have to decelerate before the speed sign
        #the maximum speed is u (u<v)
        #u*u = 2*a*s1
        #u*u - w*w = 2*a*s2
        #s1 + s2 = d
        else:
            s1=(2*a*d+w*w)/(4*a)
            s2=(2*a*d-w*w)/(4*a)
            s3=l-s1-s2
            t1=sqrt((2*s1)/a)
            t2=t1-w/a
            if (v*v-w*w)/(2*a) >= s3:
                t3=(sqrt(2*a*s3+w*w)-w)/a
                t=t1+t2+t3
                print(5)
            else:
                t4=(v-w)/a
                s4=(v*v-w*w)/(2*a)
                s5=s3-s4
                t5=s5/v
                t=t1+t2+t4+t5
                print(6)
    print(t)
    return

CF_5D()


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())
    #Don't have to decelerate before the speed sign
    if w*w/(2*a) >= d:
        if v*v/(2*a) >= l:
            t=sqrt(2*l/a)
        else:
            t1=v/a
            t2=(l-v*v/(2*a))/v
            t=t1+t2
    #Have to decelerate before the speed sign
    #u*u = 2*a*s1
    #u*u - w*w = 2*a*s2
    #s1 + s2 = d
    else:
        s1=(2*a*d+w*w)/(4*a)
        s2=(2*a*d-w*w)/(4*a)
        s3=l-s1-s2
        t1=sqrt((2*s1)/a)
        t2=t1-w/a
        if (v*v-w*w)/(2*a) >= s3:
            t3=(sqrt(2*a*s3+w*w)-w)/a
            t=t1+t2+t3
        else:
            t4=(v-w)/a
            s4=(v*v-w*w)/(2*a)
            s5=s3-s4
            t5=s5/v
            t=t1+t2+t4+t5
    print(t)
    return

CF_5D()


"""
a - acceleration (deceleration) speed
v - maximum speed
l - length of the road
d - distance of the speed sign
w - speed limited
"""
from math import sqrt

def CF_5D():
    a,v=map(int,input().split())
    l,d,w=map(int,input().split())
    if v<w:
        w=v

    #v*v = 2*a*s1
    #v*v - w*w = 2*a*s2
    #if s1+s2<=d
    #The car can reach v before passing the speed sign
    #Otherwise, the car can't reach v before passing the speed sign
    if v*v/(2*a) + (v*v-w*w)/(2*a) <= d:
        t1=v/a
        s1=v*v/(2*a)
        t3=(v-w)/a
        s3=(v*v-w*w)/(2*a)
        s2=d-s1-s3
        t2=s2/v
        s4=l-s1-s2-s3
        if (v*v-w*w)/(2*a) >= s4:
            t4=(sqrt(2*a*s4+w*w)-w)/a
            t=t1+t2+t3+t4
        else:
            t5=(v-w)/a
            s5=(v*v-w*w)/(2*a)
            s6=s4-s5
            t6=s6/v
            t=t1+t2+t3+t5+t6
    #The car can't reach v before passing the speed sign
    else:
        #Don't have to decelerate before the speed sign
        if w*w/(2*a) >= d:
            if v*v/(2*a) >= l:
                t=sqrt(2*l/a)
            else:
                t1=v/a
                t2=(l-v*v/(2*a))/v
                t=t1+t2
        #Have to decelerate before the speed sign
        #the maximum speed is u (u<v)
        #u*u = 2*a*s1
        #u*u - w*w = 2*a*s2
        #s1 + s2 = d
        else:
            s1=(2*a*d+w*w)/(4*a)
            s2=(2*a*d-w*w)/(4*a)
            s3=l-s1-s2
            t1=sqrt((2*s1)/a)
            t2=t1-w/a
            if (v*v-w*w)/(2*a) >= s3:
                t3=(sqrt(2*a*s3+w*w)-w)/a
                t=t1+t2+t3
            else:
                t4=(v-w)/a
                s4=(v*v-w*w)/(2*a)
                s5=s3-s4
                t5=s5/v
                t=t1+t2+t4+t5
    print(t)
    return

CF_5D()


#!/usr/bin/env python
"""
CodeForces: 5D Follow Trafic Rules

Basic equations for acceleration, distance and velocity (speed):

    eqn-1) final velocity:      v = v0 + a * t
    eqn-2) distance traveled:   d = v0 * t + a * t * t / 2
    eqn-3) acceleration:        v * v - v0 * v0 = 2 * a * d

    Symbols stand for:
        a: acceleration
        d: distance traveled
        t: travel time
        v0: initial speed
        v: final speed
"""

from math import sqrt

def main():
    a, v = map(int, input().split())
    l, d, w = map(int, input().split())

    # if v <= w, virtually no speed limit
    if v <= w:
        w = v

    # there are three cases before reaching the sign:
    # Case 1: unable to drive over the speed limit
    #   i.e. no need to decelerate during the travel
    # Case 2: able to drive over the speed limit
    #   Case 2a: able to drive at the max speed
    #     i.e. accelerate and deceleration
    #   Case 2b: unable to drive at the max speed
    #     i.e. find the possible max speed, then same as case 2a

    ax2 = a * 2
    vxv = v * v
    wxw = w * w
    ax2xd = ax2 * d

    # eqn-3:
    #   d1 = travel distance to reach the speed limit
    #   w * w - 0 * 0 = 2 * a * d1
    # if d1 >= d or v == w, then Case 1
    # otherwise Case 2
    if wxw >= ax2xd or v == w:
        # Case 1: unable to drive over the speed limit

        # check if able to drive at the max spped before reaching the goal
        # eqn-3:
        #   m = distance to reach the max speed
        #   v * v - 0 * 0 = 2 * a * m
        # if m <= l (distance to the goal), then
        #   2 * a * s <= 2 * a * l
        #   v * v <= 2 * a * l
        if vxv <= ax2 * l:
            # able to drive at the max speed
            # eqn-1:
            #   t1 = time to reach the max speed
            #   v = a * t1
            # eqn-3:
            #   d1 = distance traveled to reach the max speed
            #   v * v = 2 * a * d1
            # equation:
            #   d2 = remaining distance = l - d1
            #   t2 = remaining time
            #   d2 = v * t2
            hours = (v / a) + ((l - (vxv / ax2)) / v)
        else:
            # unable to drive at the max speed
            # eqn-2: time of the entire travel
            #   l = a * t * t / 2
            hours = sqrt(2.0 * l / a)
    else:
        # Case 2: able to drive over the speed limit
        # there are three steps:
        #  Step 1: find the possible max speed and
        #          travel distance at that speed
        #    Step 1a: Case 2a
        #    Step 1b: Case 2b
        #  Step 2: calculate the time to the sing
        #  Step 3: calculate the time after the sign

        # Step 1: find the possible max speed (p)
        #         and the distance travels (r) at the possible max speed
        # eqn-3:
        #   d1 = distance to the max speed (acceleration)
        #   d2 = distance to the speed limit (deceleration)
        #   v * v - 0 * 0 = 2 * a * d1
        #   v * v - w * w = 2 * a * d2  <--  w * w - v * v = 2 * (-a) * d2
        # add two equations:
        #   v * v + (v * v - w * w) = 2 * a * (d1 + d2)
        # if (d1 + d2) <= d, then Case 2a
        # otherwise Case 2b
        vxv_wxw = vxv - wxw
        s = vxv + vxv_wxw
        if s <= ax2xd:
            # Case 2a: able to drive at the max speed
            # i.e. find the distance travels (r) at the max speed
            # eqn-3:
            #   v * v + (v * v - w * w) = 2 * a * (d1 + d2)
            #   d1 + d2 + r = d
            p = v
            r = d - (s / ax2)
        else:
            # Case 2b: unable to drive at the max speed
            # i.e. find the possible max speed (p)
            # eqn-3:
            #   d1 = distance to reach the possible max speed
            #   d2 = distance to reach the speed limit
            #   p = possible max speed when d1 + d2 == d
            #   p * p - 0 * 0 = 2 * a * d1
            #   p * p - w * w = 2 * a * d2  <--  w * w - p * p = 2 * (-a) * d2
            # add two equation
            #   2 * (p * p) - (w * w) = 2 * a * (d1 + d2)
            p = sqrt((ax2xd + wxw) * 0.5)
            r = 0

        # Step 2: calculate the time to the sign

        # Time to reach the sign
        # eqn-2:
        #   t1, d1 = time and distance to reach the possible max speed
        #   t2, d2 = time and distance to reach the speed limit
        #   p = 0 + a * t1
        #   p - w = a * t2  <--  w = p + (-a) * t2
        # add two equations:
        #   p + (p - w) = a * (t1 + t2)
        # equation:
        #   r = travel distance at the possible max speed
        #   t3 = travel time at the possible max speed
        #   r = p * t3
        hours = ((p + (p - w)) / a) + (r / p)

        # Step 3: time after the sign

        # Check if able to drive at the max speed
        # eqn-2:
        #   d1 = distance to reach the max speed
        #   v * v - w * w = 2 * a * d1
        # if d1 >= d, able to drive at the max speed
        # else possible reach the max speed
        g = l - d
        s = ax2 * g
        if vxv_wxw >= s:
            # reach the goal before reaching the max speed
            # eqn-2:
            #   g = remaining distance
            #   t1 = time to the goal
            #   g = l - d = w * t1 + a * t1 * t1 / 2
            # solve the equation for t1 (positive):
            #   t1 = (sqrt(2 * a * g - w * w) - w) / a
            hours += (sqrt(s + wxw) - w) / a
        else:
            # possible to reach the max before reaching the goal
            # eqn-1:
            #   t1 = time to reach the max speed
            #   v = w + a * t1
            # eqn-3:
            #   d1 = distance to reach the max speed
            #   v * v - w * w = 2 * a * d1
            # equation:
            #   d2 = remaining distance after reaching the max speed
            #   t2 = time after reaching the max speed
            #   d2 = g - d1 = v * t2
            hours += ((v - w) / a) + ((g - (vxv_wxw / ax2)) / v)

    print("{:.12f}".format(hours))

if __name__ == '__main__':
    main()


import math

def getdt():
    return map(int,input().split())
def calc(v0,v,a,x):
    t = (v - v0)/a
    x0 = v0 * t + 0.5*a*t*t
    if x0>=x:
        return (x,(math.sqrt(v0*v0 + 2*a*x)-v0)/a)
    return (x0,t)
def go(v0,v,a,x):
    x0,t = calc(v0,v,a,x)
    return t + (x-x0)/v

a,v = getdt()
l,d,w = getdt()
if w>v:
    w = v
x,t = calc(0,w,a,d)
if x==d:
    print(go(0,v,a,l))
else:
    print(t+go(w,v,a,(d-x)*0.5) * 2 + go(w,v,a,l-d))


# -*- coding: utf-8 -*-
"""
Created on Mon Sep 17 10:52:55 2018

@author: haoqianqiong

Keep going !!! Walking to Lose Weight!!!
"""

"""
题目理解：物理问题——加速度与时间、距离的计算与比较
主要是考虑多种情形
1、最高速小于等于限速
"""
import math

def getdt():
    return map(int,input().split())
def calc(v0,v,a,x):
    t = (v - v0)/a
    x0 = v0 * t + 0.5*a*t*t
    if x0>=x:
        return (x,(math.sqrt(v0*v0 + 2*a*x)-v0)/a)
    return (x0,t)
def go(v0,v,a,x):
    x0,t = calc(v0,v,a,x)
    return t + (x-x0)/v

a,v = getdt()
l,d,w = getdt()
if w>v:
    w = v
x,t = calc(0,w,a,d)
if x==d:
    print(go(0,v,a,l))
else:
    print(t+go(w,v,a,(d-x)*0.5) * 2 + go(w,v,a,l-d))


import math

def initial_calc_time(init_velocity, v, a, x):
    t = (v - init_velocity)/a
    init_distance = init_velocity * t + 0.5*a*t*t
    if init_distance >= x:
        return (x, (math.sqrt(init_velocity*init_velocity + 2*a*x)-init_velocity)/a)
    return (init_distance, t)

def calc_time(init_velocity, v, a, x):
    init_distance, t = initial_calc_time(init_velocity, v, a, x)
    return t + (x-init_distance)/v

a, v = map(int, input().split())
l, d, w = map(int, input().split())

if w > v:
    w = v
x, t = initial_calc_time(0, w, a, d)

if x == d:
    print("%.5f" % calc_time(0, v, a, l))
else:
    print("%.5f" % (t+calc_time(w, v, a, (d-x)*0.5) * 2 + calc_time(w, v, a, l-d)))


"""
Codeforces
5D - Follow Traffic Rules
http://codeforces.com/contest/5/problem/D

Héctor González Belver
../07/2018
"""
import sys

def time_distance(v0, a, d):
  #quadratic equation. Time is positive ==> root with (+discriminant) in quadratic formula
  #d = v0*t + (a/2)*t^2
  return (-v0 + (v0**2 + 2*a*d)**0.5)/a

def time_accelerating(v0, v1, a):
  return (v1 - v0)/a

def time_speed(v, d):
  return d/v

def distance_travelled(v0, t, a):
  return v0*t + (a/2)*t**2

def main():
  a, v = map(int,sys.stdin.readline().strip().split())
  l, d, w = map(int,sys.stdin.readline().strip().split())

  time = 0

  time_to_d = time_distance(0, a, d)
  time_to_v = time_accelerating(0, v, a)

  if (v if time_to_v <= time_to_d else time_to_d * a) <= w:
    #Accelerating 0-v
    acceleration_time = time_to_v
    acceleration_distance = distance_travelled(0, acceleration_time, a)

    if acceleration_distance >= l:
      #Accelerating 0-?
      time = time_distance(0, a, l)
    else:
      #Accelerating 0-v
      time = acceleration_time
      #Max speed v
      time += time_speed(v, l - acceleration_distance)

  else:
    if time_to_v <= time_to_d:
      #Accelerating 0-v
      acceleration_time = time_to_v
      acceleration_distance = distance_travelled(0, acceleration_time, a)

      #Decelerating v-w
      deceleration_time = time_accelerating(v, w, -a)
      deceleration_distance = distance_travelled(v, deceleration_time, -a)

    if time_to_v > time_to_d or acceleration_distance + deceleration_distance > d:
      #Accelerating 0-w
      acceleration_time = time_accelerating(0, w, a)
      acceleration_distance = distance_travelled(0, acceleration_time, a)

      remaining_distance = d - acceleration_distance
      #Remaining distance --> Acceleration = -Deceleration ==> half remaining distance each action
      delta_time = time_distance(w, a, remaining_distance/2)
      #Accelerating 0-? and Decelerating ?-w
      time = acceleration_time + 2*delta_time
    else:
      #Accelerating 0-v
      time = time_to_v
      #Max speed v
      time += time_speed(v, d - deceleration_distance - acceleration_distance)
      #Decelerating v-w
      time += deceleration_time

    #Accelerating w-v
    acceleration_time = time_accelerating(w, v, a)
    acceleration_distance = distance_travelled(w, acceleration_time, a)
    if acceleration_distance >= l - d:
      #Accelerating w-?
      time += time_distance(w, a, l - d)
    else:
      #Accelerating w-v
      time += acceleration_time
      #Max speed v
      time += time_speed(v, l - (d + acceleration_distance))

  sys.stdout.write('{0:.5f}'.format(time) + '\n')

if __name__ == '__main__':
  main()


# -*- coding: utf-8 -*-
"""
Created on Sun Mar  4 22:28:47 2018

@author: hp
"""

[a,v] = [eval(x) for x in str.split(input())]
[l,d,w] = [eval(x) for x in str.split(input())]

if v <= w:
    if v ** 2 >= 2 * a *l:
        #accer all the way
        t = (2 * l / a) ** 0.5
    else:
        #accer to v,then drive with v
        s1 = v ** 2 / (2 * a)
        t1 = v / a
        s2 = l - s1
        t2 = s2 / v
        t = t1 + t2
else:
    if w ** 2 >= 2 * a * d:
        #accer all the way to d
        if v ** 2 >= 2 * a *l:
            #accer all the way
            t = (2 * l / a) ** 0.5
        else:
            #accer to v,then drive with v
            s1 = v ** 2 / (2 * a)
            t1 = v / a
            s2 = l - s1
            t2 = s2 / v
            t = t1 + t2
    else:
        #drive to w and keep,after drive to d,then accer
        t1 = w / a
        s1 = a * t1 ** 2 / 2
        s2 = d - s1
        t2 = s2 / w
        #judge if we can accer to v
        if v ** 2 - w ** 2 >= 2 * a * (l - d):
            #accer all the left
            t3 = ( -w + (w ** 2 + 2 * a * (l - d)) ** 0.5) / a
            t = t1 + t2 + t3
        else:
            #accert to v,then v
            t3 = (v - w) / a
            s3 = w * t3 + a * t3 ** 2 / 2
            t4 = (l - d - s3) / v
            t = t1 + t2 + t3 + t4

print("%.5f" %(t))


# -*- coding: utf-8 -*-
"""
Created on Sun Mar  4 22:28:47 2018

@author: hp
"""

[a,v] = [eval(x) for x in str.split(input())]
[l,d,w] = [eval(x) for x in str.split(input())]

if v <= w:
    if v ** 2 >= 2 * a *l:
        #accer all the way
        t = (2 * l / a) ** 0.5
    else:
        #accer to v,then drive with v
        s1 = v ** 2 / (2 * a)
        t1 = v / a
        s2 = l - s1
        t2 = s2 / v
        t = t1 + t2
else:
    if w ** 2 >= 2 * a * d:
        #accer all the way to d
        if v ** 2 >= 2 * a *l:
            #accer all the way
            t = (2 * l / a) ** 0.5
        else:
            #accer to v,then drive with v
            s1 = v ** 2 / (2 * a)
            t1 = v / a
            s2 = l - s1
            t2 = s2 / v
            t = t1 + t2
    else:
        if (2 * a * d + w ** 2) / 2 <= v ** 2:
            #drive to speed v1 and dec to w,after drive to d,then accer
            v1 = ((2 * a * d + w ** 2) / 2) ** 0.5
            t1 = v1 / a
            t2 = (v1 - w) / a
        else:
            #accer to v,then keep,then dec to w
            t1 = v / a + (v - w) / a
            t2 = (d - v ** 2 / (2 * a) - (v ** 2 - w ** 2) / (2 * a)) / v
        #judge if we can accer to v
        if v ** 2 - w ** 2 >= 2 * a * (l - d):
            #accer all the left
            t3 = ( -w + (w ** 2 + 2 * a * (l - d)) ** 0.5) / a
            t = t1 + t2 + t3
        else:
            #accert to v,then v
            t3 = (v - w) / a
            s3 = w * t3 + a * t3 ** 2 / 2
            t4 = (l - d - s3) / v
            t = t1 + t2 + t3 + t4

print("%.10f" %(t))


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
lowtime = max(0, v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
else:
    u = sqrt(a * d + w**2 / 2)
    ans = (2 * u - w) / a
    w = min(u, w)
highdist = min(v, w) * lowtime + a * lowtime**2 / 2
if highdist <= l - d:
    ans += lowtime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
w = min(v, w)
lowtime = (v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
elif w**2 <= 2 * d * a:
    u = sqrt(a * d + w**2 / 2)
    ans = 2 * (u - w) / a
else:
    ans = sqrt(2 * d / a)
    w = ans * a
hightime = (v - w) / a
highdist = w * hightime + a * hightime**2 / 2
if highdist <= l - d:
    ans += hightime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
lowtime = max(0, v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
else:
    u = sqrt(a * d + w**2 / 2)
    ans = u / a
    if u > w:
        ans += (u - w) / a
    w = min(u, w)
hightime = max(0, v - w) / a
highdist = w * hightime + a * hightime**2 / 2
if highdist <= l - d:
    ans += hightime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
lowtime = max(0, v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
else:
    u = sqrt(a * d + w**2 / 2)
    ans = u / a
    if u > w:
        ans += (u - w) / a
    w = min(u, w)
highdist = min(v, w) * lowtime + a * lowtime**2 / 2
if highdist <= l - d:
    ans += lowtime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
w = min(v, w)
lowtime = (v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
elif w**2 <= 2 * d * a:
    u = sqrt(a * d + w**2 / 2)
    ans = (2 * u - w) / a
else:
    ans = sqrt(2 * d / a)
    w = ans * a
hightime = (v - w) / a
highdist = w * hightime + a * hightime**2 / 2
if highdist <= l - d:
    ans += hightime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
lowtime = max(0, v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d or v <= w:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
else:
    u = sqrt(a * d + w**2 / 2)
    ans = (2 * u - w) / a
highdist = min(v, w) * lowtime + a * lowtime**2 / 2
if highdist <= l - d:
    ans += lowtime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


from math import sqrt

a, v = map(int, input().split())
l, d, w = map(int, input().split())
lowtime = max(0, v - w) / a
lowdist = v * lowtime - a * lowtime**2 / 2
startdist = v**2 / (2 * a)
if startdist + lowdist <= d:
    ans = v / a + (d - startdist - lowdist) / v + lowtime
else:
    u = sqrt(a * d + w**2 / 2)
    ans = (2 * u - w) / a
highdist = min(v, w) * lowtime + a * lowtime**2 / 2
if highdist <= l - d:
    ans += lowtime + (l - d - highdist) / v
else:
    disc = sqrt(w**2 + 2 * a * (l - d))
    ans += (disc - w) / a
print('%.7f' % ans)


import logging
logging.basicConfig(level=logging.INFO)

def readintGenerator():
	while (True):
		n=0
		tmp=list(map(lambda x:int(x), input().split()))
		m=len(tmp)
		while (n<m):
			yield(tmp[n])
			n+=1

readint=readintGenerator()
a=next(readint)
v=next(readint)
l=next(readint)
d=next(readint)
w=next(readint)

def sqrt(x): return x**0.5

def cost(v0,l,v,a):
	s0=(v**2 - v0**2)/(2*a)
	if (s0<=l):
		return (v-v0)/a + (l-s0)/v
	else:
		v1=sqrt(v0**2+2*a*l)
		return (v1-v0)/a

def calc(a,v,l,d,w):
	if (v<=w):
		return cost(0,l,v,a)
	else:
		v0=sqrt(2*a*d)
		if (v0<=w):
			return cost(0,l,v,a)
		else:
			v1=sqrt((2*a*d+w**2)/2)
			t0=(2*v1-w)/a
			if (v1<=v):
				return t0+cost(w,l-d,v,a)
			else:
				t0=(d+(2*v**2-2*v*w+w**2)/(2*a))/v
				return t0+cost(w,l-d,v,a)

print("%.8f" %calc(a,v,l,d,w))


def dist(init_speed, final_speed, accel)
	return (final_speed ** 2 - init_speed ** 2) / (2 * accel)
end

def travel_time(init_speed, accel, distance)
	return (-init_speed + Math.sqrt(init_speed ** 2 + 2 * accel * distance)) / accel
end

a, v = gets.split.map(&:to_f)
l, d, w = gets.split.map(&:to_f)
if v <= w
	distance = dist(0, v, a)
	if distance > l
		time = travel_time(0, a, l)
	else
		time = v / a + (l - distance) / v
	end
else
	distance = dist(0, w, a)
	if distance >= d
		distance = dist(0, v, a)
		if distance > l
			time = travel_time(0, a, l)
		else
			time = v / a + (l - distance) / v
		end
	else
		time = w / a
		time +=	2 * travel_time(w, a, (d - distance) / 2)

		distance_max = dist(w, v, a)
		extra_distance = l - d
		if distance_max > extra_distance
			time += travel_time(w, a, extra_distance)
		else
			time += travel_time(w, a, distance_max)
			time += (extra_distance - distance_max) / v
		end
	end
end
puts "%0.6f" % time


def dist(init_speed, final_speed, accel)
	return (final_speed ** 2 - init_speed ** 2) / (2 * accel)
end

def travel_time(init_speed, accel, distance)
	return (-init_speed + Math.sqrt(init_speed ** 2 + 2 * accel * distance)) / accel
end

a, v = gets.split.map(&:to_f)
l, d, w = gets.split.map(&:to_f)
if v <= w
	distance = dist(0, v, a)
	if distance > l
		time = travel_time(0, a, l)
	else
		time = v / a + (l - distance) / v
	end
else
	distance = dist(0, w, a)
	if distance >= d
		distance = dist(0, v, a)
		if distance > l
			time = travel_time(0, a, l)
		else
			time = v / a + (l - distance) / v
		end
	else
		time = w / a

		distance_max = dist(w, v, a)
		v_max = Math.sqrt(w ** 2 + 2 * a * ((d - distance) / 2))
		if v_max <= v
			time +=	2 * travel_time(w, a, (d - distance) / 2)
		else
			time += 2 * travel_time(w, a, distance_max)
			time += (d - distance - 2 * distance_max) / v
		end

		extra_distance = l - d
		if distance_max > extra_distance
			time += travel_time(w, a, extra_distance)
		else
			time += travel_time(w, a, distance_max)
			time += (extra_distance - distance_max) / v
		end
	end
end
puts "%0.6f" % time


def dist init_speed, final_speed, accel
	return (final_speed ** 2 - init_speed ** 2) / (2 * accel)
end

def travel_time init_speed, accel, distance
	return (-init_speed + Math.sqrt(init_speed ** 2 + 2 * accel * distance)) / accel
end

def no_speed_limit a, v, l, d, w
	distance = dist(0, v, a)
	if distance > l
		return travel_time(0, a, l)
	else
		return v / a + (l - distance) / v
	end
end

a, v = gets.split.map(&:to_f)
l, d, w = gets.split.map(&:to_f)
if v <= w
	time = no_speed_limit(a, v, l, d, w)
else
	distance = dist(0, w, a)
	if distance >= d
		time = no_speed_limit(a, v, l, d, w)
	else
		time = w / a
		time +=	2 * travel_time(w, a, (d - distance) / 2)

		distance_max = dist(w, v, a)
		extra_distance = l - d
		if distance_max > extra_distance
			time += travel_time(w, a, extra_distance)
		else
			time += travel_time(w, a, distance_max)
			time += (extra_distance - distance_max) / v
		end
	end
end
puts "%.6f" % time


from __future__ import division
from math import sqrt

__author__ = 'jay'

def main():
    a, v = (int(x) for x in raw_input().split())
    l, d, w = (int(x) for x in raw_input().split())
    t1 = v / a
    t2 = sqrt(d * 2 / a)
    t3 = w / a
    bt = min(t1, t2, t3)
    bv = a * bt
    s1 = 0.5 * bv * bt
    if s1 < d:
        tt = (-bv + sqrt(bv ** 2 + 2 * a * (d - s1) / 2)) / a
        if bv + a * tt <= v:
            bt += tt * 2
        else:
            tt = (v - bv) / a
            bt += tt * 2 + (d - s1 - (v + bv) / 2 * tt * 2) / v
    remain = l - d
    afs = 0.5 * (v + bv) * (v - bv) / a
    if afs < remain:
        print "%.6f" % (bt + (v - bv) / a + (remain - afs) / v)
        return
    print "%.6f" % (bt + (-bv + sqrt(bv ** 2 + 2 * a * remain)) / a)

if __name__ == "__main__":
    main()


import sys
import math

DEBUG = False

########################################

def solve():
	''' Solution here '''

	a, v, l, d, w = map( float, fin.read().split() )

	acc_t = lambda v0, v: (v - v0) / a
	dec_t = lambda v0, v: (v0 - v) / a

	acc_d = lambda v0, v: v0 * acc_t(v0, v) + a * acc_t(v0, v) * acc_t(v0, v) / 2
	dec_d = lambda v0, v: v0 * dec_t(v0, v) - a * dec_t(v0, v) * dec_t(v0, v) / 2

	ans = float()

	# if we can't exceed limit => remove road sign
	if w >= v:
		w = 0
		d = 0

	# end of distance
	end_acc_d = acc_d(w, v)

	if end_acc_d <= l - d:
		ans = acc_t(w, v) + (l - d - end_acc_d) / v
	else:
		ans = ( (-1) * w + math.sqrt( w * w + 2 * a * (l - d) ) ) / a

	# if no road sign => quit
	if d == 0:
		quit( str( ans ) )

	# acc && dec
	start_t  = acc_t(0, v)
	finish_t = dec_t(v, w)

	start_d  = acc_d(0, v)
	finish_d = dec_d(v, w)

	counter = 0

	l, r = 0.0, 1000000.0
	u = (l + r) / 2
	dist = acc_d(0, u) + dec_d(u, w)
	while abs( dist - d ) > 1e-7:
		if dist < d:
			l = u
		else:
			r = u
		u = (l + r) / 2
		dist = acc_d(0, u) + dec_d(u, w)

	if u <= v:
		ans += acc_t(0, u) + dec_t(u, w)
	else:
		ans += acc_t(0, v)
		ans += dec_t(v, w)
		ans += (d - start_d - finish_d) / v

	quit( str( ans ) )

########################################

def init():
	global fin, fout
	if DEBUG:
		fin  = open('input.txt', 'r')
	else:
		fin  = sys.stdin
	fout = sys.stdout

def quit(message=None):
	global fin, fout
	if message is not None:
		fout.write(message)
	fin.close()
	fout.close()
	sys.exit(0)

if __name__ == '__main__':
	init()
	solve()
	quit()


import sys
import math

DEBUG = False

########################################

def solve():
	''' Solution here '''

	a, v, l, d, w = map( float, fin.read().split() )

	acc_t = lambda v0, v: (v - v0) / a
	dec_t = lambda v0, v: (v0 - v) / a

	acc_d = lambda v0, v: v0 * acc_t(v0, v) + a * acc_t(v0, v) * acc_t(v0, v) / 2
	dec_d = lambda v0, v: v0 * dec_t(v0, v) - a * dec_t(v0, v) * dec_t(v0, v) / 2

	ans = float()

	# if we can't exceed limit before road sign => remove road sign
	limit_d = acc_d(0, w)
	if limit_d >= d:
		if acc_d(0, v) < l:
			ans = acc_t(0, v) + ( l - acc_d(0, v) ) / v
		else:
			ans = math.sqrt( 2 * l / a )
		quit( str( ans ) )

	# if we can't exceed limit at all => remove road sign
	if w >= v:
		w = 0
		d = 0

	# end of distance
	end_acc_d = acc_d(w, v)

	if end_acc_d <= l - d:
		ans = acc_t(w, v) + (l - d - end_acc_d) / v
	else:
		ans = ( (-1) * w + math.sqrt( w * w + 2 * a * (l - d) ) ) / a

	# if no road sign => quit
	if d == 0:
		quit( str( ans ) )

	l, r = 0.0, 1000000.0
	u = (l + r) / 2
	dist = acc_d(0, u) + dec_d(u, w)
	while abs( dist - d ) > 1e-7:
		if dist < d:
			l = u
		else:
			r = u
		u = (l + r) / 2
		dist = acc_d(0, u) + dec_d(u, w)

	if u <= v:
		ans += acc_t(0, u) + dec_t(u, w)
	else:
		ans += acc_t(0, v)
		ans += dec_t(v, w)
		ans += (d - acc_d(0, v) - dec_d(v, w)) / v

	quit( str( ans ) )

########################################

def init():
	global fin, fout
	if DEBUG:
		fin  = open('input.txt', 'r')
	else:
		fin  = sys.stdin
	fout = sys.stdout

def quit(message=None):
	global fin, fout
	if message is not None:
		fout.write(message)
	fin.close()
	fout.close()
	sys.exit(0)

if __name__ == '__main__':
	init()
	solve()
	quit()


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

if v >= w:
  t1 = v / a
  t2 = (v - w) / a
  s1 = (t1 * v) / 2.0
  s2 = (t2 * (w + v)) / 2.0
  if s1 + s2 <= d:
    s3 = d - s1 - s2
    t3 = s3 / v
    t = t1 + t2 + t3
    wf = w
  else:
    t3 = w / a
    s3 = (w * w) / (2 * a)
    if s3 >= d:
      if s1 <= l:
        print t1 + (l - s1) / v
        exit()
      t = math.sqrt((2.0 * d) / a)
      wf = a * t
    else:
      x = math.sqrt((w * w + 2.0 * a * d) / 2.0)
      t = (2.0 * x - w) / a
      wf = w
else:
  t1 = v / a
  s1 = (t1 * v) / 2.0
  if s1 <= d:
    t2 = (d - s1) / v
    t = t1 + t2
    wf = v
  else:
    t = math.sqrt((2.0 * d) / a)
    wf = a * t

t1 = (v - wf) / a
s1 = (a * t1 * t1) / 2.0
if s1 <= l - d:
  t += t1 + (l - d - s1) / v
else:
  t += (-wf + math.sqrt(wf * wf - 2 * a * (d - l))) / a

print t


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

if v >= w:
  t1 = v / a
  t2 = (v - w) / a
  s1 = (t1 * v) / 2.0
  s2 = v * t2 - (a * t2 * t2) / 2.0
  if s1 + s2 <= d:
    s3 = d - s1 - s2
    t3 = s3 / v
    t = t1 + t2 + t3
    wf = w
  else:
    t3 = w / a
    s3 = (w * w) / (2 * a)
    if s3 >= d:
      t = math.sqrt((2.0 * d) / a)
      wf = a * t
    else:
      x = math.sqrt((w * w + 2.0 * a * d) / 2.0)
      t = (2.0 * x - w) / a
      wf = w
else:
  t1 = v / a
  s1 = (t1 * v) / 2.0
  if s1 <= d:
    t2 = (d - s1) / v
    t = t1 + t2
    wf = v
  else:
    t = math.sqrt((2.0 * d) / a)
    wf = a * t

t1 = (v - wf) / a
s1 = wf * t1 + (a * t1 * t1) / 2.0
if s1 <= l - d:
  t += t1 + (l - d - s1) / v
else:
  t += (-wf + math.sqrt(wf * wf - 2 * a * (d - l))) / a

print t


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

if v >= w:
  t1 = v / a
  t2 = (v - w) / a
  s1 = (t1 * v) / 2.0
  s2 = (t2 * (w + v)) / 2.0
  if s1 + s2 <= d:
    s3 = d - s1 - s2
    t3 = s3 / v
    t = t1 + t2 + t3
    wf = w
  else:
    t3 = w / a
    s3 = (t3 * w) / 2.0
    if s3 >= d:
      t = math.sqrt((2.0 * d) / a)
      wf = a * t
    else:
      x = math.sqrt((w * w + 2.0 * a * d) / 2.0)
      t = (2.0 * x - w) / a
      wf = w
else:
  t1 = v / a
  s1 = (t1 * v) / 2.0
  if s1 <= d:
    t2 = (d - s1) / v
    t = t1 + t2
    wf = v
  else:
    t = math.sqrt((2.0 * d) / a)
    wf = a * t

t1 = (v - wf) / a
s1 = (a * t1 * t1) / 2.0
if s1 <= l - d:
  t += t1 + (l - d - s1) / v
else:
  t += (-wf + math.sqrt(wf * wf - 2 * a * (d - l))) / a

print t


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

total_time = 0.0

if w >= v:
        mark = (v ** 2) / (2 * a)

        if l >= mark:
                total_time += (l / v) + (v / (2 * a))
        else:
                total_time += math.sqrt((2 * l) / a)
else:
        mark1 = (2 * (v ** 2) - (w ** 2)) / (2 * a)
        mark2 = (w ** 2) / (2 * a)

        if d >= mark1:
                total_time += (d / v) + (v / a) + ((w ** 2) / (2 * a * v)) - (w / a)
        elif d > mark2:
                total_time += (math.sqrt((4 * a * d) + (2 * (w ** 2))) - w) / a
        else:
                total_time += math.sqrt((2 * d) / a)
                w = math.sqrt(2 * a * d)

        rem = l - d
        mark = ((v ** 2) - (w ** 2)) / (2 * a)

        if rem >= mark:
                total_time += (rem / v) + (v / (2 * a)) + ((w ** 2) / (2 * a * v)) - (w / a)
        else:
                total_time += (math.sqrt((2 * a * rem) + (w ** 2)) - w) / a

print "%.8f" % total_time


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

total_time = 0.0

if w >= v:
        mark = (v ** 2) / (2 * a)

        if l >= mark:
                total_time += (l / v) + (v / (2 * a))
        else:
                total_time += math.sqrt((2 * l) / a)
else:
        mark1 = (2 * (v ** 2) - (w ** 2)) / (2 * a)
        mark2 = (w ** 2) / (2 * a)

        if d >= mark1:
                total_time += (d / v) + (v / a) + ((w ** 2) / (2 * a * v)) - (w / a)
        elif d > mark2:
                total_time += (math.sqrt((4 * a * d) + (2 * (w ** 2))) - w) / a
        else:
                total_time += math.sqrt((2 * d) / a)

        rem = l - d
        mark = ((v ** 2) - (w ** 2)) / (2 * a)

        if rem >= mark:
                total_time += (rem / v) + (v / (2 * a)) + ((w ** 2) / (2 * a * v)) - (w / a)
        else:
                total_time += (math.sqrt((2 * a * rem) + (w ** 2)) - w) / a

print "%.5f" % total_time


import math

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

total_time = 0.0

if w >= v:
        mark = (v ** 2) / (2 * a)

        if l >= mark:
                total_time += (l / v) + (v / (2 * a))
        else:
                total_time += math.sqrt((2 * l) / a)
else:
        mark1 = (2 * (v ** 2) - (w ** 2)) / (2 * a)
        mark2 = (w ** 2) / (2 * a)

        if d >= mark1:
                total_time += (d / v) + (v / a) + ((w ** 2) / (2 * a * v)) - (w / a)
        elif d > mark2:
                total_time += (math.sqrt((4 * a * d) + (2 * (w ** 2))) - w) / a
        else:
                total_time += math.sqrt((2 * d) / a)
                w = math.sqrt 2 * a * d)

        rem = l - d
        mark = ((v ** 2) - (w ** 2)) / (2 * a)

        if rem >= mark:
                total_time += (rem / v) + (v / (2 * a)) + ((w ** 2) / (2 * a * v)) - (w / a)
        else:
                total_time += (math.sqrt((2 * a * rem) + (w ** 2)) - w) / a

print "%.8f" % total_time


a,Vmax=raw_input().split()
l,d,w=raw_input().split()
a=float(a)
Vmax=float(Vmax)
l=float(l)
d=float(d)
w=float(w)
import math
Smax=(Vmax**2)/(2*a)
Sd=((Vmax**2)-(w**2))/(2*a)
s=l-d
if(math.sqrt(2*a*d)<=w):
   if(Smax>=l):
      V1=math.sqrt(2*a*l)
      time=V1/a
   else:
      time=(Vmax/a) + ((l-Smax)/Vmax)
elif(Vmax>w):
   S1=((w*w)+(2*a*d))/(4*a)
   V1=math.sqrt(2*a*S1)
   t1=(V1/a)+((V1-w)/a)
   if(V1>Vmax):
      t1=((Vmax)/a)+((Vmax-w)/a)+((d-(Smax+Sd))/Vmax)
      s=l-d
   if(Sd>=s):
      V1=math.sqrt((w**2)+(2*a*s))
      t=((V1-w)/a)
   else:
      s=l-d
      t=((Vmax-w)/a)+((s-Sd)/Vmax)
   time=t1+t
else:
   if(Smax>=l):
      V1=math.sqrt(2*a*l)
      time=(V1/a)
   else:
      time=(Vmax/a)+((l-Smax)/Vmax)

x='%.5f' %time
print(x)


a,Vmax=raw_input().split()
l,d,w=raw_input().split()
a=float(a)
Vmax=float(Vmax)
l=float(l)
d=float(d)
w=float(w)
import math
Smax=(Vmax**2)/(2*a)
Sd=((Vmax**2)-(w**2))/(2*a)
s=l-d
if(Vmax>w):
   S1=((w*w)+(2*a*d))/(4*a)
   V1=math.sqrt(2*a*S1)
   t1=(V1/a)+((V1-w)/a)
   if(V1>Vmax):
      t1=((Vmax)/a)+((Vmax-w)/a)+((d-(Smax+Sd))/Vmax)
      s=l-d
   if(Sd>=s):
      V1=math.sqrt((w**2)+(2*a*s))
      t=((V1-w)/a)
   else:
      s=l-d
      t=((Vmax-w)/a)+((s-Sd)/Vmax)
   time=t1+t
else:
   if(Smax>=l):
      V1=math.sqrt(2*a*l)
      time=(V1/a)
   else:
      time=(Vmax/a)+((l-Smax)/Vmax)

x='%.5f' %time
print(x)


import math
def t_second(a,v,D,w):
    acc_dis = (pow(v,2) - pow(w,2)) / (a * 2.0)
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt((2 * D) / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2.0)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (v - w) / a + w / a + (d - pow(v,2) / 2.0 * a + pow(v - w,2) / 2.0 * a) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
#print(t1,t2)
result  = 1.0*t1 + 1.0*t2
print(result)


import math
def t_second(a,v,D,w):
    acc_dis = (v - w) / a * (v - w) / 2.0
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt(2 * D / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2.0)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (v - w) / a + w / a + (d - pow(v,2) / 2.0 * a + pow(v - w,2) / 2.0 * a) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
#print(t1,t2)
result  = 1.0*t1 + 1.0*t2
print(result)


import math
def t_second(a,v,D,w):
    acc_dis = (pow(v,2) - pow(w,2)) / (a * 2.0)
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt((2 * D) / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2.0)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (2.0 * v - w) / a + (d - (pow(v,2) / (2.0 * a)) - ((pow(v,2) - pow(w,2)) / (2.0 * a))) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
result  = 1.0*t1 + 1.0*t2
print(result)


import math
def t_second(a,v,D,w):
    acc_dis = (v - w) / a * (v - w) / 2
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt(2 * D / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (v - w) / a + w / a + (d - pow(v,2) / 2.0 * a + pow(v - w,2) / 2.0 * a) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
t = 0
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
result  = t1 + t2
print(result)


import math
def getfloats(): return map(float, raw_input().split())

def calc(v0, v, a, x):
    t = (v - v0) / a
    x0 = v0 * t + 0.5 * a * t * t
    if x0 > x: return (x, (math.sqrt(v0 * v0 + 2 * a * x) - v0) / a)
    return (x0, t)

def go(v0, v, a, x):
    x0, t = calc(v0, v, a, x)
    return t + (x - x0) / v

a, v = getfloats()
l, d, w = getfloats()
if w > v: w = v

x, t = calc(0, w, a, d)
if x == d: print go(0, v, a, l)
else: print t + go(w, v, a, (d - x) * 0.5) * 2 + go(w, v, a, l - d)


import math
def t_second(a,v,D,w):
    acc_dis = (pow(v,2) - pow(w,2)) / (a * 2.0)
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt((2 * D) / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2.0)
        print(v_max)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (2.0 * v - w) / a + (d - (pow(v,2) / (2.0 * a)) - ((pow(v,2) - pow(w,2)) / (2.0 * a))) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
result  = 1.0*t1 + 1.0*t2
print(result)


import math
def t_second(a,v,D,w):
    acc_dis = (v - w) / a * (v - w) / 2.0
    if D > acc_dis:
        t =  (v - w) / a + (D - acc_dis) / v
    else:
        t = math.sqrt(2 * D / a + pow(w / a,2)) - w / a
    return t
def t_first(a,v,d,w):
    dis_acc_w = pow(w,2) / (2.0 * a)
    if d <= dis_acc_w:
        t = math.sqrt(2.0 * d / a)
        vi = a * t
    else:
        vi = w
        v_max = math.sqrt(a * d + pow(w,2) / 2.0)
        if v_max <= v:
            t = (v_max) / a + (v_max-w) / a
        else:
            t = (v - w) / a + w / a + (d - pow(v,2) / 2.0 * a + pow(v - w,2) / 2.0 * a) / v
    return t,vi
a,v = map(float,raw_input().split())
l,d,w = map(float,raw_input().split())
if w >= v:
    w = v
t1,vi = t_first(a,v,d,w)
t2 = t_second(a,v,l-d,vi)
print(t1,t2)
result  = 1.0*t1 + 1.0*t2
print(result)


from sys import stdin
from math import *

def floats(s):
    return [float(x) for x in s.split()]

a, v = floats(stdin.readline())

l, d, w = floats(stdin.readline())

def fastest(x):
    tmax = v / a
    xmax = a * tmax * tmax / 2.0
    if xmax > x:
        return sqrt((x / a) * 2.0)
    else:
        return tmax + (x - xmax) / v

if v <= w:
    print('{0:.9f}'.format(fastest(l)))
else:
    lo, hi = 0, d
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = fastest(mid)
        u = min([v, a*t])
        if u < w:
            lo = mid
        else:
            need = (u - w) / a
            dist = u * need - a * need * need / 2
            if dist > (d - mid):
                hi = mid
            else:
                lo = mid
    t = fastest(lo)
    u = min([v, a*t])
    if u > w:
        t += (u - w) / a
    lo, hi = 0, fastest(l - d)
    for k in range(500):
        tt = (lo + hi) / 2.0
        tmax = (v - w) / 2.0
        if tt < tmax:
            dist = tt * w + a * tt * tt / 2.0
        else:
            dist = tmax * w + a * tmax * tmax / 2.0 + v * (tt - tmax)
        if dist > l - d:
            hi = tt
        else:
            lo = tt
    print('{0:.9f}'.format(t + lo))


from sys import stdin
from math import *

def floats(s):
    return [float(x) for x in s.split()]

a, v = floats(stdin.readline())

l, d, w = floats(stdin.readline())

def fastest(x, u):
    lo, hi = 0, 1000000
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = (v - u) / a
        if t > mid:
            dist = u * mid + a * mid * mid / 2.0
        else:
            dist = u * t + a * t * t / 2.0 + v * (mid - t)
        if dist > x:
            hi = mid
        else:
            lo = mid
    return lo

if v <= w:
    print('{0:.9f}'.format(fastest(l, 0.0)))
else:
    lo, hi = 0, d
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = fastest(mid, 0.0)
        u = min([v, a*t])
        if u < w:
            lo = mid
        else:
            need = (u - w) / a
            dist = u * need - a * need * need / 2
            if dist > (d - mid):
                hi = mid
            else:
                lo = mid
    t = fastest(lo, 0.0)
    u = min([v, a*t])
    if u > w:
        t += (u - w) / a
    print('{0:.9f}'.format(t + fastest(l - d, w)))


from sys import stdin
from math import *

def floats(s):
    return [float(x) for x in s.split()]

a, v = floats(stdin.readline())

l, d, w = floats(stdin.readline())

def fastest(x):
    tmax = v / a
    xmax = a * tmax * tmax / 2.0
    if xmax > x:
        return sqrt((x / a) * 2.0)
    else:
        return tmax + (x - xmax) / v

if v <= w:
    print('{0:.9f}'.format(fastest(l)))
else:
    lo, hi = 0, d
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = fastest(mid)
        u = min([v, a*t])
        if u < w:
            lo = mid
        else:
            need = (u - w) / a
            dist = u * need - a * need * need / 2
            if dist > (d - mid):
                hi = mid
            else:
                lo = mid
    t = fastest(lo)
    u = min([v, a*t])
    if u > w:
        t += (u - w) / a
    lo, hi = 0, fastest(l - d)
    for k in range(500):
        tt = (lo + hi) / 2.0
        tmax = (v - w) / a
        if tt < tmax:
            dist = tt * w + a * tt * tt / 2.0
        else:
            dist = tmax * w + a * tmax * tmax / 2.0 + v * (tt - tmax)
        if dist > l - d:
            hi = tt
        else:
            lo = tt
    print('{0:.9f}'.format(t + lo))


from sys import stdin
from math import *

def floats(s):
    return [float(x) for x in s.split()]

a, v = floats(stdin.readline())

l, d, w = floats(stdin.readline())

def fastest(x, u):
    lo, hi = 0, 1000000
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = (v - u) / a
        if t > mid:
            dist = u * mid + a * mid * mid / 2.0
        else:
            dist = u * t + a * t * t / 2.0 + v * (mid - t)
        if dist > x:
            hi = mid
        else:
            lo = mid
    return lo

if v <= w:
    print('{0:.9f}'.format(fastest(l, 0.0)))
else:
    lo, hi = 0, d
    for k in range(500):
        mid = (lo + hi) / 2.0
        t = fastest(mid, 0.0)
        u = min([v, a*t])
        if u < w:
            lo = mid
        else:
            need = (u - w) / a
            dist = u * need - a * need * need / 2
            if dist > (d - mid):
                hi = mid
            else:
                lo = mid
    t = fastest(lo, 0.0)
    u = min([v, a*t])
    if u > w:
        t += (u - w) / a
    print('{0:.9f}'.format(t + fastest(l - d, min([w, u]))))


import math

# Get the Input as a float number

def getfloats():
	return map(float, raw_input().split())

# Calculate

def calc(v0,v,a,x):
	t = (v-v0) /a # Find the time to get the v speed with accelaration a
	x0 = v0*t+ 0.5 * a * t*t # Normal formula S=ut +(1/2 ) * a*t^2 to find the distance covered at t time ,

	print "X0 and t0",x0,t

	if x0 > x:
		return  ( x, (math.sqrt(v0*v0 +2*a*x) - v0) /a) # if the distance to slow down become bigger than the actual speed
						# then calculate v^2=u^2+2*a*s formula , to find t
						# the calculation here v= sqrt(u^2+2as)
						# => u+at=sqrt(u^2+2*a*s)
						# t =sqrt(u^2+2as)-u / a
						# so this is the time to go distance s
	return (x0,t)

def go(v0,v,a,x):
		x0,t =calc(v0,v,a,x)
		print "Fractional ",x0, t
		return t + (x-x0)/v # Here this is time to reach t and after passing the signal move with maximum speed
				    # The equation for this should be (x-x0) = maximum speed (v) * t1 ( remaining time to reach 	# other city

a,v=getfloats()

l,d,w=getfloats()

if w > v: w=v

x ,t = calc(0,w,a,d)

print "Obtained x and t and w",x, t, w

if x == d: print go(0,v,a,l)
else: print t + go(w,v,a,(d-x)*0.5) * 2 + go ( w,v,a,l-d)


import math

# Get the Input as a float number

def getfloats():
	return map(float, raw_input().split())

# Calculate

def calc(v0,v,a,x):
	t = (v-v0) /a # Find the time to get the v speed with accelaration a
	x0 = v0*t+ 0.5 * a * t*t # Normal formula S=ut +(1/2 ) * a*t^2 to find the distance covered at t time ,

	#print "X0 and t0",x0,t

	if x0 > x:
		return  ( x, (math.sqrt(v0*v0 +2*a*x) - v0) /a) # if the distance to slow down become bigger than the actual speed
						# then calculate v^2=u^2+2*a*s formula , to find t
						# the calculation here v= sqrt(u^2+2as)
						# => u+at=sqrt(u^2+2*a*s)
						# t =sqrt(u^2+2as)-u / a
						# so this is the time to go distance s
	return (x0,t)

def go(v0,v,a,x):
		x0,t =calc(v0,v,a,x)
	#	print "Fractional ",x0, t
		return t + (x-x0)/v # Here this is time to reach t and after passing the signal move with maximum speed
				    # The equation for this should be (x-x0) = maximum speed (v) * t1 ( remaining time to reach 	# other city

a,v=getfloats()

l,d,w=getfloats()

if w > v: w=v

x ,t = calc(0,w,a,d)

#print "Obtained x and t and w",x, t, w

if x == d: print go(0,v,a,l)
else: print t + go(w,v,a,(d-x)*0.5) * 2 + go ( w,v,a,l-d)


from math import sqrt

def float_cmp(x, y = 0, tol = 1e-9):
    return (-1 if x + tol < y else 0) if x <= y + tol else 1

def velocity_at_d(k):
    det = 2*a * (2*k - d)
    return sqrt(det)    if det >= 0 else    0

def velocity_at_d_vm(k):
    det = v**2 - 2*a*(d-k)
    return sqrt(det)    if det >= 0 else    0

def binary_search(low, high, f, y):
    while float_cmp(low, high) != 0:
        x = (low + high) / 2
        fx = f(x)

        # print "(%.2f - %.2f) : f(%.2f) = %.2f vs. %2f" % (low, high, x, fx, y)

        if float_cmp(fx, y) < 0:
            low = x
        elif float_cmp(fx, y) > 0:
            high = x
        else:
            return x

    return x

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

td = sqrt(2 * d/a)  # time to get to sign
vd = a * td         # speed at sign

if float_cmp(min(v, vd), w) <= 0:
    # car's limit speed is le. than sign speed
    # or speed at sign is le. than sign speed

    if float_cmp(v, sqrt(2*a*l)) >= 0:
        # limit speed is greater than achievable speed
        time = sqrt(2 * l/a)
    else:
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2
        time += (l - distance) / v

else:
    k = binary_search(0, d, velocity_at_d, w)
    vk = sqrt(2*a*k)

    if float_cmp(vk, v) <= 0:
        # we can reach the peak
        time = sqrt(2 * k/a) + (vk-w)/a
    else:
        # get as close as the peak as we can
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2

        k = binary_search(distance, d, velocity_at_d_vm, w)
        time += (k - distance)/v + (v - sqrt(v**2 - 2*a*(d-k)))/a

    t = (v-w)/a    # time to get to limit speed
    distance = a/2 * t**2 + w * t

    if float_cmp(d + distance, l) <= 0:
        # we reach top velocity before arriving
        time += (l - d - distance) / v
    else:
        # we reach top velocity after arriving
        time += (-w + sqrt(w**2 - 2*a*(d-l)))/a

print time


from math import sqrt

def float_cmp(x, y = 0, tol = 1e-9):
    return (-1 if x + tol < y else 0) if x <= y + tol else 1

def velocity_at_d(k):
    det = 2*a * (2*k - d)
    return sqrt(det)    if det >= 0 else    0

def velocity_at_d_vm(k):
    det = v**2 - 2*a*(d-k)
    return sqrt(det)    if det >= 0 else    0

def binary_search(low, high, f, y):
    while float_cmp(low, high) != 0:
        x = (low + high) / 2
        fx = f(x)

        # print "(%.2f - %.2f) : f(%.2f) = %.2f vs. %2f" % (low, high, x, fx, y)

        if float_cmp(fx, y) < 0:
            low = x
        elif float_cmp(fx, y) > 0:
            high = x
        else:
            return x

    return x

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

td = sqrt(2 * d/a)  # time to get to sign
vd = a * td         # speed at sign

if float_cmp(min(v, vd), w) <= 0:
    # car's limit speed is le. than sign speed
    # or speed at sign is le. than sign speed

    if float_cmp(v, sqrt(2*a*l)) >= 0:
        # limit speed is greater than achievable speed
        time = sqrt(2 * l/a)
    else:
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2
        time += (l - distance) / v

else:
    k = binary_search(0, d, velocity_at_d, w)
    vk = sqrt(2*a*k)

    if float_cmp(vk, v) <= 0:
        # we can reach the peak
        time = sqrt(2 * k/a) + (vk - w) / a
    else:
        # get as close as the peak as we can
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2

        k = binary_search(distance, d, velocity_at_d_vm, w)
        time += (k - distance) / v + (v - w) / a

    t = (v - w) / a    # time to get to limit speed
    distance = a/2 * t**2 + w * t

    if float_cmp(d + distance, l) <= 0:
        # we reach top velocity before arriving
        time += t + (l - d - distance) / v
    else:
        # we reach top velocity after arriving
        time += (-w + sqrt(w**2 - 2*a*(d-l)))/a

print time


from math import sqrt

def velocity_at_d(k):
    det = 2*a * (2*k - d)
    return sqrt(det)    if det >= 0 else    0

def velocity_at_d_vm(k):
    det = v**2 - 2*a*(d-k)
    return sqrt(det)    if det >= 0 else    0

def binary_search(low, high, f, y):
    while low != high:
        x = (low + high) / 2
        fx = f(x)

        # print "(%.2f - %.2f) : f(%.2f) = %.2f vs. %2f" % (low, high, x, fx, y)

        if fx < y:
            low = x
        elif fx > y:
            high = x
        else:
            return x

    return x

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

td = sqrt(2 * d/a)  # time to get to sign
vd = a * td         # speed at sign

if min(v, vd) <= w:
    # car's limit speed is le. than sign speed
    # or speed at sign is le. than sign speed

    if v >= sqrt(2*a*l):
        # limit speed is greater than achievable speed
        time = sqrt(2 * l/a)
    else:
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2
        time += (l - distance) / v

else:
    k = binary_search(0, d, velocity_at_d, w)
    vk = sqrt(2*a*k)

    if vk <= v:
        # we can reach the peak
        time = sqrt(2 * k/a) + (vk-w)/a
    else:
        # get as close as the peak as we can
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2

        k = binary_search(distance, d, velocity_at_d_vm, w)
        time += (k - distance)/v + (v - sqrt(v**2 - 2*a*(d-k)))/a

    t = (v-w)/a    # time to get to limit speed
    distance = a/2 * t**2 + w * t

    if d + distance <= l:
        # we reach top velocity before arriving
        time += (l - d - distance) / v
    else:
        # we reach top velocity after arriving
        time += (-w + sqrt(w**2 - 2*a*(d-l)))/a

print time


from math import sqrt

def float_cmp(x, y = 0, tol = 1e-9):
    return (-1 if x + tol < y else 0) if x <= y + tol else 1

a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())

td = sqrt(2 * d/a)  # time to get to sign
vd = a * td         # speed at sign

if float_cmp(min(v, vd), w) <= 0:
    # car's limit speed is le. than sign speed
    # or speed at sign is le. than sign speed

    if float_cmp(v, sqrt(2*a*l)) >= 0:
        # limit speed is greater than achievable speed
        time = sqrt(2 * l/a)
    else:
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2
        time += (l - distance) / v

else:
    k = (2*a*d + w**2) / (4*a)
    vk = sqrt(2*a*k)

    if float_cmp(vk, v) <= 0:
        # we can reach the peak
        time = sqrt(2 * k/a) + (vk - w) / a
    else:
        # get as close as the peak as we can
        time = v/a    # time to get to limit speed
        distance = a/2 * time**2

        k = (2*a*d - v**2 + w**2) / (2*a)
        time += (k - distance) / v + (v - w) / a

    t = (v - w) / a    # time to get to limit speed
    distance = a/2 * t**2 + w * t

    if float_cmp(d + distance, l) <= 0:
        # we reach top velocity before arriving
        time += t + (l - d - distance) / v
    else:
        # we reach top velocity after arriving
        time += (-w + sqrt(w**2 - 2*a*(d-l)))/a

print time


import math
def getfloats(): return map(float, raw_input().split())

def calc(v0, v, a, x):
	t = (v - v0) / a
	x0 = v0 * t + 0.5 * a * t * t
	if x0 > x: return (x, (math.sqrt(v0 * v0 + 2 * a * x) - v0) / a)
	return (x0, t)

def go(v0, v, a, x):
	x0, t = calc(v0, v, a, x)
	return t + (x - x0) / v

a, v = getfloats()
l, d, w = getfloats()
if w > v: w = v

x, t = calc(0, w, a, d)
if x == d: print go(0, v, a, l)
else: print t + go(w, v, a, (d - x) * 0.5) * 2 + go(w, v, a, l - d)


import math

def main():
    (a, v) = map(float, raw_input().split())
    (l, d, w) = map(float, raw_input().split())
    w = min(v, w)
    if (w * w) >= 2 * a * d:
        v1 = math.sqrt(2 * a * d)
        t1 = math.sqrt(2 * d / a)
    elif 2 * a * d + w * w > 2 * v * v:
        v1 = w
        t1 = (2 * v - w) / a + (d - (2 * v * v - w * w) / 2 / a) / v
    else:
        v1 = w
        t1 = (2 * math.sqrt(a * d + w * w / 2) - w) / a
    if 2 * a * (l - d) + v1 * v1 > v * v:
        t2 = (v - v1) / a + (l - d - (v * v - v1 * v1) / 2 / a) / v
    else:
        t2 = (math.sqrt(2 * a * (l - d) + v1 * v1) - v1) / a
    print '%.6lf' % (t1 + t2)

if __name__ == '__main__':
    main()


import math
a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())
# print 'a', a
# print 'v', v
# print 'l', l
# print 'd', d
# print 'w', w

if w >= v:
	w = v
len_reach_v = v**2 / (2*a)
time_reach_v = v / a
len_reach_w = w**2 / (2*a)
time_reach_w = w / a

# print 'w->', w, 'v->', v
if l <= len_reach_w:
	# print '1'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l <= len_reach_v:
	# print '2'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l > len_reach_v:
	# print '3'
	res_time1 = time_reach_v
	res_time2 = (l - len_reach_v) / v
	res_time = res_time1 + res_time2
elif d > len_reach_w:

	delta_dis = d - len_reach_w
	res_time1 = time_reach_w
	if w == v:
		res_time2 = (l - len_reach_w) / w
		res_time = res_time1 + res_time2
	elif w < v:
		dis_w_to_v = (v**2 - w**2)/(2*a)
		key_dis = 2 * dis_w_to_v
		if delta_dis <= key_dis: #cannot allow to reach v, instead, reach v_max
			v_max = math.sqrt(a*delta_dis + w**2)
			res_time2 = delta_dis / ((w+v_max)/2)
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4
		else: # can reach v
			res_time2 = 2 * (dis_w_to_v / ((w + v)/2)) + delta_dis - 2*dis_w_to_v / v
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4

print '%.12f' % res_time


import math
a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())
# print 'a', a
# print 'v', v
# print 'l', l
# print 'd', d
# print 'w', w

if w >= v:
	w = v
len_reach_v = v**2 / (2*a)
time_reach_v = v / a
len_reach_w = w**2 / (2*a)
time_reach_w = w / a

# print 'w->', w, 'v->', v
if l <= len_reach_w:
	# print '1'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l <= len_reach_v:
	# print '2'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l > len_reach_v:
	# print '3'
	res_time1 = time_reach_v
	res_time2 = (l - len_reach_v) / v
	res_time = res_time1 + res_time2
elif d > len_reach_w:

	delta_dis = d - len_reach_w
	res_time1 = time_reach_w
	if w == v:
		res_time2 = (l - len_reach_w) / w
		res_time = res_time1 + res_time2
	elif w < v:
		dis_w_to_v = (v**2 - w**2)/(2*a)
		key_dis = 2 * dis_w_to_v
		if delta_dis <= key_dis: #cannot allow to reach v, instead, reach v_max
			v_max = math.sqrt(a*delta_dis + w**2)
			res_time2 = delta_dis / ((w+v_max)/2)
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4
		else: # can reach v
			res_time2 = 2 * (dis_w_to_v / ((w + v)/2)) + delta_dis - 2*dis_w_to_v / v
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4

print '%.10f' % res_time


import math
a, v = map(float, raw_input().split())
l, d, w = map(float, raw_input().split())
# print 'a', a
# print 'v', v
# print 'l', l
# print 'd', d
# print 'w', w

if w >= v:
	w = v
len_reach_v = v**2 / (2*a)
time_reach_v = v / a
len_reach_w = w**2 / (2*a)
time_reach_w = w / a

# print 'w->', w, 'v->', v
if l <= len_reach_w:
	# print '1'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l <= len_reach_v:
	# print '2'
	res_time = math.sqrt(2*l/a)
elif d <= len_reach_w and l > len_reach_v:
	# print '3'
	res_time1 = time_reach_v
	res_time2 = (l - len_reach_v) / v
	res_time = res_time1 + res_time2
elif d > len_reach_w:
	# print '4'
	delta_dis = d - len_reach_w
	res_time1 = time_reach_w
	if w == v:
		# print '5'
		res_time2 = (l - len_reach_w) / w
		res_time = res_time1 + res_time2
	elif w < v:
		# print '6'
		dis_w_to_v = (v**2 - w**2)/(2*a)
		key_dis = 2 * dis_w_to_v
		if delta_dis <= key_dis: #cannot allow to reach v, instead, reach v_max
			# print '7'
			v_max = math.sqrt(a*delta_dis + w**2)
			res_time2 = delta_dis / ((w+v_max)/2)
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				# print '8'
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				# print '9'
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4
		else: # can reach v
			# print '10'
			res_time2 = 2 * (dis_w_to_v / ((w + v)/2)) + (delta_dis - 2*dis_w_to_v) / v
			if (l - d) <= dis_w_to_v: # cannot reach v after the distance d
				# print '11'
				v3_max = math.sqrt(2*a*(l-d) + w**2)
				res_time3 = (l-d) / ((w+v3_max)/2)
				res_time = res_time1 + res_time2 + res_time3
			else:
				# print '12'
				res_time3 = dis_w_to_v / ((w + v)/2)
				res_time4 = (l - d - dis_w_to_v) / v
				res_time = res_time1 + res_time2 + res_time3 + res_time4

print '%.12f' % res_time


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            int[] cars = new int[n];
            for (int i = 0; i < n; i++)
            {
                cars[i] = int.Parse(_input[i]);
            }
            Array.Sort(cars);
            int count = 0;
            int x = 0, z = n - 1;
            while (x < z)
            {
                if (cars[z] == 4)
                {
                    if (z - x == 1)
                    {
                        count += 2;
                        break;
                    }
                    else
                    {
                        count++;
                        z--;
                    }
                }
                else if (cars[z] + cars[x] > 4)
                {
                    if (z - x == 1)
                    {
                        count += 2;
                        break;
                    }
                    else
                    {
                        count++;
                        z--;
                    }
                }
                else if (cars[z] + cars[x] == 4)
                {
                    z--;
                    x++;
                    count++;
                }
                else if (cars[z] + cars[x] < 4)
                {
                    cars[z] += cars[x];
                    x++;
                }
            }
            if (count == 1) count++;
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            int[] cars = new int[n];
            for (int i = 0; i < n; i++)
            {
                cars[i] = int.Parse(_input[i]);
            }
            Array.Sort(cars);
            int count = 0;
            int x = 0, z = n - 1;
            while (x < z)
            {
                if (cars[z] == 4)
                {
                    count++;
                    z--;
                }
                else if (cars[z] + cars[x] > 4)
                {
                    if (z - x == 1)
                    {
                        count += 2;
                        break;
                    }
                    else
                    {
                        count++;
                        z--;
                    }
                }
                else if (cars[z] + cars[x] == 4)
                {
                    z--;
                    x++;
                    count++;
                }
                else if (cars[z] + cars[x] < 4)
                {
                    cars[z] += cars[x];
                    x++;
                }

            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            int[] cars = new int[n];
            for (int i = 0; i < n; i++)
            {
                cars[i] = int.Parse(_input[i]);
            }
            Array.Sort(cars);
            int count = 0;
            int x = 0, z = n - 1;
            while (x < z)
            {
                if (cars[z] == 4)
                {
                    count++;
                    z--;
                }
                else if (cars[z] + cars[x] > 4)
                {
                    //if (z - x == 1)
                    //{
                    //    count += 2;
                    //    break;
                    //}
                    //else
                    //{
                        count++;
                        z--;
                    //}
                }
                else if (cars[z] + cars[x] == 4)
                {
                    z--;
                    x++;
                    count++;
                }
                else if (cars[z] + cars[x] < 4)
                {
                    cars[z] += cars[x];
                    x++;
                    count--;
                }
            }
            count++;
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            List<int> cars = new List<int>();
            int count = 0;
            for(int i = 0; i < n; i ++)
            {
                if(int.Parse(_input[i]) == 4)
                {
                    count++;
                }
                else
                {
                    int cont = 0, j;
                    for(j = 0; j < cars.Count; j ++)
                    {
                        if((cars[j] + int.Parse(_input[i])) > 4)
                        {
                            cont++;
                        }
                        else
                        {
                            cars[j] += int.Parse(_input[i]);
                            if (cars[j] == 4)
                            {
                                cars.RemoveAt(j);
                                count++;
                            }
                        }
                    }
                    if (cont == j)
                        cars.Add(int.Parse(_input[i]));
                }
            }
            count += cars.Count;
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            int[] cars = new int[n];
            for (int i = 0; i < n; i++)
            {
                cars[i] = int.Parse(_input[i]);
            }
            Array.Sort(cars);
            int count = 0;
            int x = 0, z = n - 1;
            while (x < z)
            {
                if (cars[z] == 4)
                {
                    if (z - x == 1)
                    {
                        count += 2;
                        break;
                    }
                    else
                    {
                        count++;
                        z--;
                    }
                }
                else if (cars[z] + cars[x] > 4)
                {
                    if (z - x == 1)
                    {
                        count += 2;
                        break;
                    }
                    else
                    {
                        count++;
                        z--;
                    }
                }
                else if (cars[z] + cars[x] == 4)
                {
                    z--;
                    x++;
                    count++;
                }
                else if (cars[z] + cars[x] < 4)
                {
                    cars[z] += cars[x];
                    x++;
                }
            }
            count++;
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            int[] cars = new int[n];
            for (int i = 0; i < n; i++)
            {
                cars[i] = int.Parse(_input[i]);
            }
            Array.Sort(cars);
            int count = 0;
            int x = 0, z = n - 1;
            while (x <= z)
            {
                if(x == z)
                {
                    count++;
                    break;
                }

                if(cars[z] == 4)
                {
                    count++;
                    z--;
                }
                else if(cars[z] + cars[x] == 4)
                {
                    count++;
                    z--;
                    x++;
                }
                else if(cars[z] + cars[x] > 4)
                {
                    count++;
                    z--;
                }
                else if(cars[z] + cars[x] < 4)
                {
                    cars[z] += cars[x];
                    x++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string input = Console.ReadLine();
            string[] _input = input.Split(' ');
            List<int> cars = new List<int>();
            int count = 0;
            for(int i = 0; i < n; i ++)
            {
                if(int.Parse(_input[i]) == 4)
                {
                    count++;
                }
                else
                {
                    int cont = 0, j;
                    for(j = 0; j < cars.Count; j ++)
                    {
                        if((cars[j] + int.Parse(_input[i])) > 4)
                        {
                            cont++;
                        }
                        else
                        {
                            cars[j] += int.Parse(_input[i]);
                        }
                    }
                    if (cont == j)
                        cars.Add(int.Parse(_input[i]));
                }
            }
            count += cars.Count;
            Console.WriteLine(count);
        }
    }
}