409908: GYM103831 G Monetary system of the Land of Fools
Description
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.
InputFirst 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).
OutputOutput two space separated integers, the minimal and maximal wooden value of the golden coin.
ScoringSolutions that fail the tests in the examples will be awarded 0 points and not be further tested.
Each test is scored separately.
ExamplesInput3 10 2Output
1 2 3
7 7Input
3 15 3Output
1 2 5
4 13