{"problem":{"name":"[ICPC 2020 Shanghai R] Walker","description":{"content":"As a world-famous traveler, Prof. Pang's research interest is to travel as many places as possible in his life. We have a segment $[0, n]$. There are two travelers on it. The first one is on position","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":1048576},"difficulty":{"LuoguStyle":"P3"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9822"},"statements":[{"statement_type":"Markdown","content":"As a world-famous traveler, Prof. Pang's research interest is to travel as many places as possible in his life.\n\nWe have a segment $[0, n]$. There are two travelers on it. The first one is on position $p_1$ with velocity $v_1$ (which means s/he can walk $v_1$ unit on the segment per second). The second one is on position $p_2$ with velocity $v_2$.\n\nFrom their respective beginning points, travelers can walk on the segment. They cannot walk outside the segment. Whenever they want to change their direction, they can turn around immediately.\n\nPlease help Prof. Pang to calculate the minimum  possible time by which every position of the segment is passed by at least one traveler.\n\n## Input\n\nThe first line contains one integer $test~(1\\le test\\le 10000)$ -- the number of test cases.\n\nThe $i$-th of the next $test$ lines contains five numbers $n, p_{1, i}, v_{1, i}, p_{2, i}, v_{2, i}$ ($0 < n \\le 10000$, $0\\le p_{1, i},p_{2, i} \\le n$, $0.001 \\le v_{1, i},v_{2, i} \\le 1000$). All numbers have at most $3$ digits after the decimal point.\n\n## Output\n\nFor each test case, we should output one number -- the minimum time that every position of the segment is passed by at least one traveler.\n\nYour answer is considered correct if its absolute or relative error does not exceed $10^{-6}$.\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9822","tags":["数学","2020","二分","上海","Special Judge","O2优化","ICPC"],"sample_group":[["2\n10000.0 1.0 0.001 9999.0 0.001\n4306.063 4079.874 0.607 1033.423 0.847","5001000.0000000000\n3827.8370013755"]],"created_at":"2026-03-03 11:09:25"}}