#P2077. 红绿灯
红绿灯
Description
In a city, there is a straight road with intersections, each equipped with a traffic light. The distance between two adjacent intersections is kilometers . At each intersection, the red light lasts minutes and the green light lasts minutes; there is no yellow light. Now, a car starts from a point kilometers away from intersection , and at that moment, all traffic lights have just switched from red to green. Find the time when this car passes each intersection (the car must not run red lights; its speed is kilometer per minute).
Input Format
The first line contains two positive integers and .
The second line contains positive integers .
The third line contains positive integers , the red-light durations (minutes).
The fourth line contains positive integers , the green-light durations (minutes).
Output Format
Output lines, each containing one positive integer, which is the earliest time when the car passes each intersection.
5 3
2 4 3 2
3 4 3 4 3
2 3 2 3 1
5
7
11
14
16
Hint
For of the testdata, .
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号