{"problem":{"name":"E. Meetings","description":{"content":"Two cities A and B are connected by a straight road that is exactly l meters long. At the initial moment of time a cyclist starts moving from city A to city B at a speed v1 meters/second, and a pedest","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":65536},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10050E"},"statements":[{"statement_type":"Markdown","content":"Two cities A and B are connected by a straight road that is exactly l meters long. At the initial moment of time a cyclist starts moving from city A to city B at a speed v1 meters/second, and a pedestrian starts moving from city B to city A at a speed v2 meters/second. When one of them reaches a city, the road ends, so the person has to turn around and start moving in the opposite direction by the same road, keeping the original speed. As a result, the cyclist and the pedestrian are traveling between cities A and B indefinitely.\n\nYour task is to calculate the number of times they will meet during the first t seconds. If they meet in exactly t seconds after the initial moment of time, this meeting should also be counted.\n\nThe only line of input contains four integer numbers: l, v1, v2 and t. All numbers are between 1 and 109, inclusively.\n\nPrint a single integer — the number of times the cyclist and the pedestrian will meet during the first t seconds.\n\n## Input\n\nThe only line of input contains four integer numbers: l, v1, v2 and t. All numbers are between 1 and 109, inclusively.\n\n## Output\n\nPrint a single integer — the number of times the cyclist and the pedestrian will meet during the first t seconds.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ l, v_1, v_2, t \\in \\mathbb{Z}^+ $ denote the road length, cyclist speed, pedestrian speed, and total time, respectively.\n\n**Constraints**  \n$ 1 \\leq l, v_1, v_2, t \\leq 10^9 $\n\n**Objective**  \nCompute the number of meetings between the cyclist and pedestrian in the time interval $ [0, t] $, where:  \n- The cyclist starts at position $ 0 $ (city A) moving toward $ l $ (city B) at speed $ v_1 $.  \n- The pedestrian starts at position $ l $ (city B) moving toward $ 0 $ (city A) at speed $ v_2 $.  \n- Upon reaching either end, each reverses direction instantaneously without loss of speed.  \n\nModel their positions as periodic functions with period $ \\frac{2l}{v_1} $ and $ \\frac{2l}{v_2} $, respectively.  \nThe relative motion is equivalent to a single particle moving with relative speed $ v_1 + v_2 $ on a circle of circumference $ 2l $, where each meeting corresponds to covering a distance of $ 2l $ relative to each other.  \n\nThe number of meetings in time $ t $ is:  \n$$\n\\left\\lfloor \\frac{(v_1 + v_2) t}{2l} \\right\\rfloor\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10050E","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}