Drawing a picture

Colors cycle through cells of a row-major grid; each cell area is H_i times W_j. Report the total area covered by each color.

Medium7MathPrefix sumCombinatoricsImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

Sangsu paints a picture on a grid with N rows and M columns using L colors. He paints row 1 first, then row 2, and so on through row N. Inside one row he paints column 1 first, then column 2, and so on through column M. He uses color 1, then color 2, up to color L, and after color L he goes back to color 1.

Row i has height HiH_i and column j has width WjW_j, so the cell in row i and column j has area Hi×WjH_i \times W_j.

Sangsu does not want to waste paint, so he wants to know how much of each color he needs before he starts. Compute the total area painted with each color.

Input

The first line contains N, M, and L. (1N,M,L1234561 \le N, M, L \le 123456)

The second line contains N positive integers H1,H2,,HNH_1, H_2, \dots, H_N, the height of each row, separated by spaces. The sum of HiH_i does not exceed 10910^9.

The third line contains M positive integers W1,W2,,WMW_1, W_2, \dots, W_M, the width of each column, separated by spaces. The sum of WjW_j does not exceed 10910^9.

Output

Print L lines. Line k contains the total area painted with color k.

Hint

The picture Sangsu paints in the first example looks like this.