409037: GYM103426 A Bananas Packing

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Bananas Packingtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

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.

Input

The 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$$$).

Output

Print two integers: the maximum number of boxes of bananas, and the number of bananas left.

Scoring
SubtaskScoreConstraints
130$$$n = 7$$$; $$$a_i \le 100$$$
245$$$n \le 100$$$; $$$a_i \le 1000$$$
325$$$n \le 100$$$; $$$a_i \le 10^9$$$
ExamplesInput
9
4 3 5 4 5 4 4 5 2
Output
4 8
Input
7
2 3 3 3 2 2 3
Output
2 4
Note

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$$$.

加入题单

算法标签: