#P2077. 红绿灯

红绿灯

Description

In a city, there is a straight road with NN intersections, each equipped with a traffic light. The distance between two adjacent intersections is AiA_i kilometers (1i<N)(1 \le i < N). At each intersection, the red light lasts RiR_i minutes and the green light lasts GiG_i minutes; there is no yellow light. Now, a car starts from a point MM kilometers away from intersection 11, 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 11 kilometer per minute).

Input Format

The first line contains two positive integers NN and MM.

The second line contains N1N - 1 positive integers AiA_i.

The third line contains NN positive integers RiR_i, the red-light durations (minutes).

The fourth line contains NN positive integers GiG_i, the green-light durations (minutes).

Output Format

Output NN 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 50%50\% of the testdata, N1000N \le 1000.

For 100%100\% of the testdata, N105N \le 10^5, M,Ai10M, A_i \le 10, Ri,Gi5R_i, G_i \le 5.

Translated by ChatGPT 5