atcoder#ARC106A. [ARC106A] 106

[ARC106A] 106

Score : 300300 points

Problem Statement

Given is an integer NN. Determine whether there is a pair of positive integers (A,B)(A, B) such that 3A+5B=N3^A + 5^B = N, and find one such pair if it exists.

Constraints

  • 1N10181 \leq N \leq 10^{18}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

Output

If there is no pair (A,B)(A, B) that satisfies the condition, print -1.

If there is such a pair, print AA and BB of one such pair with space in between. If there are multiple such pairs, any of them will be accepted.

106
4 2

We have 34+52=81+25=1063^4 + 5^2 = 81 + 25 = 106, so (A,B)=(4,2)(A, B) = (4, 2) satisfies the condition.

1024
-1
10460353208
21 1