Milk Exchange
시간 제한2초메모리 제한1024 MB
원형으로 배치된 소들이 매분 시계 방향으로 우유를 전부 넘기고 용량을 넘는 양은 버려질 때, 1분부터 N분까지 남은 우유의 총량을 구한다.
문제
Farmer John's cows are lined up in a circle. The th cow has a bucket with integer capacity liters. All buckets are initially full.
Every minute, cow will pass all the milk in their bucket to cow for , with cow passing its milk to cow . All exchanges happen simultaneously (i.e., if a cow has a full bucket but gives away liters of milk and also receives liters, her milk is preserved). If a cow's total milk ever ends up exceeding , then the excess milk will be lost.
After each of minutes, how much total milk is left among all cows?
입력
The first line contains .
The next line contains integers .
출력
Output lines, where the -th line is the total milk left among all cows after minutes.