#P51432. [JOI 2021 Final] Snowball

[JOI 2021 Final] Snowball

Description

The JOI plain is a wide plain spreading from west to east. We can consider the JOI plain as a number line. A spot on the JOI plain is denoted by a coordinate. The positive direction of the number line corresponds to the east direction. Now winter comes in the JOI plain. There are NN snowballs on it, numbered from 11 to NN from the west to the east. In the beginning, the coordinate of the snowball ii (1iN1 \leq i \leq N) is an integer XiX_i.

Strong wind blows in the JOI plain in winter. You have observation data of wind for QQ days. On the jj-th day (1jQ1 \leq j \leq Q), the wind is described by an integer WjW_j. If WjW_j is negative, then the wind blows to the west direction. If WjW_j is not negative, then the wind blows to the east direction. The strength of the wind is Wj|W_j|.

When wind blows, a snowball is moved to the same direction as the wind, and its length of move is equal to the strength of the wind. In other words, if there is a snowball in the coordinate xx in the beginning of the jj-th day (1jQ1 \leq j \leq Q), then the snowball is moved from the coordinate xx to the coordinate x+Wjx + W_j. At the end of the j-th day, the coordinate of the snowball becomes x+Wjx + W_j. Note that, in each day, the snowballs are moved at the same time, and their speeds are the same.

Initially, the JOI plain is covered with snow. If a snowball is moved on an interval covered with snow, then the snowball accumulates the snow, the weight of the snowball is increased, and the snow on the interval disappears. In other words, for an integer aa, assume that the interval from aa to a+1a + 1 is covered with snow. If a snowball is moved on this interval, then the weight of the snowball is increased by 11, and the snow on the interval from aa to a+1a + 1 disappears. However, if a snowball is moved on an interval without snow, the weight of the snowball remains the same.

Initially, the weight of every snowball is 00. It did not snow on the QQ days of observation data.

You want to know the weight of each snowball at the end of the QQ-th day.

Write a program which, given the initial position of each snowball and observation data of wind for QQ days, calculates the weight of each snowball at the end of the QQ-th day.

Input

Read the following data from the standard input. Given values are all integers.

N QN\ Q
X1XNX_1 \ldots X_N
W1W_1
\vdots
WQW_Q

Output

Write NN lines to the standard output. The ii-th line (1iN1 \leq i \leq N) should contain the weight of the snowball ii at the end of the QQ-th day.

Sample 1

4 3
-2 3 5 8
2
-4
7
5
4
2
6

In this sample input, the weight of each snowball varies as follows.

  • Initially, the coordinates of the snowballs are 2,3,5,8−2, 3, 5, 8 from the west to the east. The weights of the snowballs are 0,0,0,00, 0, 0, 0, respectively.
  • On the first day, wind blows to the east direction, and its strength is 22. At the end of the first day, the coordinates of the snowballs are 0,5,7,100, 5, 7, 10. The weights of the snowballs are 2,2,2,22, 2, 2, 2, respectively.
  • On the second day, wind blows to the west direction, and its strength is 44. At the end of the second day, the coordinates of the snowballs are 4,1,3,6−4, 1, 3, 6. The weights of the snowballs are 4,4,2,34, 4, 2, 3, respectively.
  • On the third day, wind blows to the east direction, and its strength is 77. At the end of the third day, the coordinates of the snowballs are 3,8,10,133, 8, 10, 13. The weights of the snowballs are 5,4,2,65, 4, 2, 6, respectively.

Hence output 5,4,2,65, 4, 2, 6, which are the weights of the snowballs at the end of the third day.

1 4
1000000000000
1000000000000
-1000000000000
-1000000000000
-1000000000000
3000000000000
10 10
-56 -43 -39 -31 -22 -5 0 12 18 22
-3
0
5
-4
-2
10
-13
-1
9
6

14
8
7
9
11
10
9
8
5
10

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5.
  • 1Q2×1051 \leq Q \leq 2 \times 10^5.
  • Xi1012|X_i| \leq 10^{12} (1iN1 \leq i \leq N).
  • XiXi+1X_i \leq X_{i+1} (1iN11 \leq i \leq N-1).
  • Wj1012|W_j| \leq 10^{12} (1jQ1 \leq j \leq Q).

Subtasks

  1. (3333 points) N2000N \leq 2000, Q2000Q \leq 2000.
  2. (6767 points) No additional constraints.