409482: GYM103577 H Hiking trip

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hiking triptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Tomi is a playful Dog. He is on a hiking trip with his humans: Eli and Rafa.

At time $$$0$$$, Eli is at position $$$0$$$. She walks at a constant speed of $$$v_0$$$ units per minute, until she reaches position $$$d$$$, where she will stop. So after $$$t \ge 0$$$ minutes, Eli will be at position $$$min(v_0 \times t, d)$$$.

At time $$$0$$$, Rafa is at position $$$1$$$. He walks at a constant speed of $$$v_1 > v_0$$$ units per minute, until he reaches position $$$d$$$, where he will stop. So after $$$t \ge 0$$$ minutes, Rafa will be at position $$$min(1 + v_1 \times t,d)$$$.

At time $$$0$$$, Tomi is at position $$$0$$$. He will move at a constant speed of $$$v_2 > v_1$$$, until he reaches Rafa's position, then he turns 180 degrees and moves at the same speed $$$v_2$$$ until he reaches Eli. He continues to go back and forth between Rafa and Eli until all 3 of them are at position $$$d$$$, where he will stop.

Your task is to determine Tomi's position after $$$t$$$ minutes.

Input

The input consists of a single line containing 5 space separated integers: $$$d$$$, $$$v0$$$, $$$v1$$$, $$$v2$$$ and $$$t$$$ ($$$1 \leq d \leq 100$$$, $$$0 \leq t \leq 100$$$, and $$$1 \leq v0 < v1 < v2 \leq 100$$$).

Output

Output a single number, the position of Tomi after $$$t$$$ minutes. Your will be judged as correct if it has an absolute or relative error of at most $$$10^{-6}$$$.

ExamplesInput
10 1 2 3 1
Output
3.0000000000
Input
10 1 2 3 10
Output
10.0000000000

加入题单

上一题 下一题 算法标签: