AT_abc432_c [ABC432C] Candy Tribulation

Description

You have an unlimited supply of two types of candies: small candies and large candies. The weight of a small candy is $ X $ grams, and the weight of a large candy is $ Y $ grams. Large candies are heavier than small candies (that is, $ X < Y $ ). There are $ N $ children, numbered $ 1 $ to $ N $ . You have decided to distribute candies so that the following conditions are satisfied: - For $ i=1,\dots,N $ , child $ i $ receives exactly $ A_i $ candies in total of the two types. - The total weights of candies distributed to the $ N $ children are all equal. Determine whether there exists a distribution method that satisfies the conditions. If it exists, find the maximum possible value for the number of large candies distributed.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ X $ $ Y $ $ A_1 $ $ \dots $ $ A_N $

Output Format

If there is no distribution method that satisfies the conditions, output `-1`. If there exists a distribution method that satisfies the conditions, output the maximum possible value for the number of large candies distributed in such a distribution method.

Explanation/Hint

### Sample Explanation 1 You can distribute candies as follows so that the total weights of candies distributed to the children are all equal. - Child $ 1 $ receives $ 4 $ small candies and $ 7 $ large candies. The total weight is $ 6 \times 4 + 8 \times 7 = 80 $ grams. - Child $ 2 $ receives $ 0 $ small candies and $ 10 $ large candies. The total weight is $ 6 \times 0 + 8 \times 10 = 80 $ grams. - Child $ 3 $ receives $ 12 $ small candies and $ 1 $ large candy. The total weight is $ 6 \times 12 + 8 \times 1 = 80 $ grams. In this distribution method, a total of $ 18 $ large candies are distributed. There is no distribution method that satisfies the conditions and distributes more than $ 18 $ large candies. Therefore, the answer is $ 18 $ . ### Sample Explanation 2 There is no distribution method that satisfies the conditions. ### Sample Explanation 3 The answer may not fit in a 32-bit integer. ### Constraints - $ 2 \leq N \leq 2 \times 10^5 $ - $ 1 \leq A_i \leq 10^9 $ - $ 1 \leq X < Y \leq 10^9 $ - All input values are integers.