Algorithms and Data Structures

• Status

• # Binge watching

Ben tries to maximize the time he watches movies. He knows that there are `n` movies that are going to be streamed on TV during the coming several days and he knows the duration of each movie. We know that Ben can only binge-watch movies for at most 5 hours (18000 seconds) and falls asleep after that. He only counts the movies that he watched from the beginning to the very end. So, if he falls asleep halfway through, that movie is not counted.
Can you help him with the decision on when to start watching, by showing how many seconds he will be able to watch fully if he starts watching from the `i`-th movie?

#### Input

The first line of the input contains the integer `n` the number of movies Ben knows are going to be streamed (1 β€ n β€ ). The following line contains `n` integers separated by a space, that represent the lengths of the movies in seconds .

#### Output

The program should print `n` integers. The number at position `i` should represent the number of seconds Ben would be able to fully watch if he starts at the movie `i`.

#### Examples

 Input Output 8 12000 3000 9000 12000 13200 13800 3600 5400 15000 12000 9000 12000 13200 17400 9000 5400
Β