201060: [AtCoder]ARC106 A - 106

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

Problem Statement

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

Constraints

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

Input

Input is given from Standard Input in the following format:

$N$

Output

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

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


Sample Input 1

106

Sample Output 1

4 2

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


Sample Input 2

1024

Sample Output 2

-1

Sample Input 3

10460353208

Sample Output 3

21 1

Input

题意翻译

输入 $n$,请找到并输出两个正整数 $a,b$,满足 $3^a+5^b=n$。如果没有符合要求的输出 `-1`。

加入题单

上一题 下一题 算法标签: