Under construction

Still being built. Things may change

Transistor Repair

Interview

Time limit2sMemory limit1024 MB

Summary
Given n leg resistances, find three of them whose sum is A and product is B, or report -1 if none exist.
Level

Medium4 of 10

Topics
Number theory, Hash map, Brute force
Solved
No attempts yet

Problem

Papus is teaching Nolik how to repair transistors. A transistor consists of a base and three legs. Each leg has an integer resistance, and the values are known. Two numbers AA and BB are written on the base. The transistor works if the sum of the leg resistances is AA and their product is BB.

After Papus left, Nolik found a transistor base. To show that he can work on his own, he wants to repair this transistor.

Nolik has nn legs in his repair kit. He knows how to repair transistors, but choosing the right legs is hard. Help him find three legs that fit this base.

Input

The first line contains three integers nn, AA, BB (3≤n≤1053 \le n \le 10^5, 1≤A,B≤1051 \le A, B \le 10^5): the number of legs in the kit, the required sum, and the required product.

The second line contains nn integers aia_i (1≤ai≤1051 \le a_i \le 10^5), the resistances of the legs in the kit.

Output

Print three integers, the resistances of suitable legs. If there are several answers, print any of them. If no answer exists, print -1.

Examples3

  1. Example 1

    Input
    5 11 40
    1 2 3 4 5
    
    Expected output
    2 4 5
    
  2. Example 2

    Input
    3 9 27
    3 3 3
    
    Expected output
    3 3 3
    
  3. Example 3

    Input
    3 9 27
    3 2 3
    
    Expected output
    -1