Arithmetic Progression
Time limit2sMemory limit512 MB
Given 2n numbers, pick n of them that form an arithmetic progression and print its first term and common difference.
Problem
One day Petya found a very important sequence of numbers. After a careful analysis, he determined that it is an arithmetic progression. So he would not forget it, he wrote its elements on cards.
Then an accident happened. Not knowing how important the sequence was, his brother Vovochka took more cards, wrote arbitrary numbers on them, and shuffled all cards together.
Now Petya wants to restore the original sequence from these cards. It may be possible to do this in several ways, but Petya is satisfied with any numbers that form an arithmetic progression.
Petya cannot do this by hand, so he asked you for help.
Input
The first line contains an integer (). The next line contains integers whose absolute values do not exceed , the numbers written on the cards, listed in arbitrary order. It is guaranteed that you can choose of them that form an arithmetic progression.
Output
Print and on the first line, the first element and the difference of the found arithmetic progression. If , the number must appear among the given numbers times.
If there are several solutions, print any of them.