409037: GYM103426 A Bananas Packing
Description
An online grocery store introduces a new product: you can buy a box of seven bananas of different ripeness, such that the first banana becomes ripe on some day, the second one — on the following day, the third — on the following day after the second one, and so on. Formally speaking, the box contains exactly seven bananas, the first one of which becomes ripe on day $$$d$$$, the second one — on day $$$d + 1$$$, the third — on day $$$d + 2$$$, the fourth — on day $$$d + 3$$$, the fifth — on day $$$d + 4$$$, the sixth — on day $$$d + 5$$$, and the seventh — on day $$$d + 6$$$.
A set of bananas was delivered to the storehouse. According to the delivery note, you know that each banana is going to become ripe on one of the following $$$n$$$ days, and for each day $$$i$$$ from 1 to $$$n$$$, you are given that $$$a_i$$$ of delivered bananas are going to become ripe on day $$$i$$$.
You task is to make the maximum number of boxes of bananas. Calculate the maximum number of boxes you are able to make, as well as the number of bananas that will remain out of the boxes.
InputThe first line contains an integer $$$n$$$ — the number of days in the delivery note ($$$7 \le n \le 100$$$).
The second line contains $$$n$$$ integers $$$a_i$$$ — the number of bananas that become ripe on day $$$i$$$ ($$$0 \le a_i \le 10^9$$$).
OutputPrint two integers: the maximum number of boxes of bananas, and the number of bananas left.
ScoringSubtask | Score | Constraints |
1 | 30 | $$$n = 7$$$; $$$a_i \le 100$$$ |
2 | 45 | $$$n \le 100$$$; $$$a_i \le 1000$$$ |
3 | 25 | $$$n \le 100$$$; $$$a_i \le 10^9$$$ |
9 4 3 5 4 5 4 4 5 2Output
4 8Input
7 2 3 3 3 2 2 3Output
2 4Note
In the first example, one of the ways is to make two boxes with $$$d = 1$$$, one box with $$$d = 2$$$, and one box with $$$d = 3$$$. Note that there are other ways to make 4 boxes.
In the second example, it's possible to make two boxes with $$$d = 1$$$.