All problems

Weekly Rollup

mediumPythonTime SeriesLists

Meridian's accountant has no use for fifty daily figures. She wants them added up in equal blocks — weeks, usually, though the owner keeps asking for fortnights and for three-day stretches around the market days. The block size arrives with the data, and the run always divides exactly, so no block is ever left short.

Task: Print the total for each block.

Input

The first line holds an integer k, the block size. The second line holds an integer n, the number of days, always a multiple of k. Each of the next n lines holds one day's takings as a whole number.

Output

One line per block, in the order the days arrived, each the block's total as a whole number. Blocks lie end to end and share no days, so n days give exactly n / k lines. With k of 1 every day is its own block and the input comes back unchanged.

Example:

Input:
2
6
1
2
3
4
5
6

Output:
3
7
11

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…