#B4233. Fastest Way Home

    ID: 11890 Type: Default 1000ms 256MiB

Fastest Way Home

Fastest Way Home

Little X is leaving school and wants to go home. His home is \(n\) meters away from the school gate. He has three ways to get home:

  1. Walk: He walks directly towards his home at a speed of \(a\) m/s. The time taken is \(\frac{n}{a}\) seconds.
  2. Bus: He can take a bus that is available right outside the school gate. However, he must wait \(t\) seconds for the bus, and then he travels at a speed of \(b\) m/s. The time taken is \(t + \frac{n}{b}\) seconds.
  3. Shared Bike: He can ride a shared bike home. The bike parking is located at a distance of \(m\) meters from the school gate. He must first walk to the bike parking (at \(a\) m/s) and then ride the bike home. Note that after boarding the bike, the journey to his home is \(n+m\) meters, and his biking speed is \(c\) m/s. Hence, the time taken is \(\frac{m}{a} + \frac{n+m}{c}\) seconds.

Your task is to calculate which mode gives the fastest time and output that minimum time.

inputFormat

A single line containing six space-separated numbers: n, a, b, t, c, m. (n) is the distance (in meters) from the school gate to home, (a), (b), and (c) are the speeds (in m/s) for walking, bus, and biking respectively, (t) is the waiting time (in seconds) for the bus, and (m) is the distance (in meters) from the school gate to the bike parking.

outputFormat

Output the minimum time (in seconds) required for Little X to get home. The answer should be a number which can be a floating-point value.

sample

100 5 10 3 20 10
7.5