eolymp
bolt
Try our new interface for solving problems
Problems

Cosine

Cosine

You are given two rational numbers x and y.

Find a non-degenerate triangle with integer side lengths such that the cosine of one angle is x and the cosine of another is y, and print its side lengths.

Input

The four lines contain four integers, one per line: P, Q, U and V (-109P, U109, 1Q, V109). These integers define x and y as follows: x = P / Q, y = U / V.

Output

If such a non-degenerate triangle exists, print three integers on the only line of output: its side lengths in non-descending order. The numbers should be coprime, that is, the greatest common divisor of these three integers should be equal to 1. If there are multiple possible answers, print any one of them.

If such a non-degenerate triangle does not exist, print one number -1 on the only line of output.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3
5
4
5
Output example #1
3 4 5
Source 2013 Petrozavodsk, MIPT contest, August 25, Problem C