Problem

21 /23


Amount multiple of 17

Problem

The input of the program is a sequence of N positive integers. All pairs of different elements of the sequence are considered, located at a distance divisible by 5 (the difference in the indices of the elements of a pair must be a multiple of 5, the order of the elements in the pair is not important). It is necessary to define a pair with the maximum sum divisible by 7. If there are several such pairs, the program should output any of them.

Input
The first line of the input specifies the number of numbers N (\(1 <= N <= 10000\)). Each of the following N lines contains one positive integer not exceeding 10,000.

Imprint
The program should print two numbers in the first line: a pair of elements with the maximum sum, located in a sequence at a distance divisible by 5, in which the sum of the elements is a multiple of 7. If there is no suitable pair, you need to print one number 0.

 

Examples
# Input Output
1 10
1
6
3
140
6
6
7
11
7
15
7 140