Mojtaba and caching thief

4.6

10 votes
Mathematics, Basic Math, Easy, Mathematics
Problem

Mojtaba is a police commander. A thief wants to escape. Mojtaba is standing at 0, The thief is standing at X on the x-axis. The thief starts to run with speed vB to right, and Mojtaba starts to cache him with speed vA. When he catches the thief, he comes back to 0 with speed vA, how much time it takes from Mojtaba to cache the thief and back to the police station?

Your answer will be considered correct if the absolute difference between the jury solution and your solution is <106

Input Format

The first line contains three space separated integers X,va,vb,0X100,1va,vB100 -- the position of the thief, speed of Mojtaba and speed of thief.

Output Format

Print how much time it takes from Mojtaba to cache the thief and back to the police station. Your answer will be considered correct if the absolute difference between the jury solution and your solution is <106. If Mojtaba can never catch thief, print 1

( Output like 1.000000...  are okay ) 

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Mojtaba caches the thief in x=4,t=2 then he comes back to police station.

Editor Image

?