A Math Problem (Easy)


Submit solution

Points: 7
Time limit: 1.0s
Python 2 2.0s
Python 3 2.0s
Memory limit: 128M

Author:
Problem types
Allowed languages
Assembly, Awk, Brain****, C, C++, Java, Pascal, Perl, Python, Text

Bob has been given a boring math problem:

Find a set of \(3\) non-negative integers denoted as \(X\), \(Y\), and \(Z\), which satisfy the following two equations:

  • \(X \cdot Y \cdot Z = A\)
  • \(X^2 + Y^2 + Z^2 = B\)

Bob has too little time to do this problem. Can you do this for Bob instead?

Input Specification

The first line of the input will contain two integers \(A\) and \(B\), where \(0 \le A, B \le 10^6\).

Output Specification

In one line, output the three corresponding integers of \(X\), \(Y\), and \(Z\), each separated by a space. If there is more than one possible solution, choose the one with the smallest \(X\) value. If there is still a tie, choose the solution with the smallest \(Y\) value.

If there are no possible combinations, output -1 instead.

Sample Input

15 35

Sample Output

1 3 5

Comments

There are no comments at the moment.