409908: GYM103831 G Monetary system of the Land of Fools

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Monetary system of the Land of Foolstime limit per test2 secondsmemory limit per test64 megabytesinputcoins.inoutputcoins.out

It is known that in the Land of Fools there are two types of currency: golden and wooden. There are coins with the values of a1, a2, …, aK wooden units and a golden coin. By the order of wise Buratino, the ruler of the Land of Fools, the monetary system of the country is organized in such a way that any amount from 1 up to M of wooden money can be paid using no more than N coins. Define the minimal and maximal amount of wooden money that the golden coin can be worth. In the case when one golden coin is equal to exactly one number of wooden units, print it as both minimal and maximal.

It is guaranteed that the order of Buratino is fulfilled and one golden coin is not worth more than M wooden units.

Input

First line contains three numbers K, M and N (1 ≤ K ≤ 500, 1 ≤ M, N ≤ 2000). Second line contains K integers a1, a2, …, aK (1 ≤ ai ≤ 500).

Output

Output two space separated integers, the minimal and maximal wooden value of the golden coin.

Scoring

Solutions that fail the tests in the examples will be awarded 0 points and not be further tested.

Each test is scored separately.

ExamplesInput
3 10 2
1 2 3
Output
7 7
Input
3 15 3
1 2 5
Output
4 13

加入题单

上一题 下一题 算法标签: