B - 3-smooth Numbers Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

正の整数 N が与えられます。 N=2^x3^y を満たす整数 x,y が存在するなら Yes 、そうでなければ No と出力してください。

制約

  • 1\leq N\leq10^{18}
  • N は整数

入力

入力は以下の形式で標準入力から与えられる。

N

出力

条件を満たす整数 x,y が存在するなら Yes 、そうでなければ No1 行に出力せよ。


入力例 1

324

出力例 1

Yes

x=2,y=4 とすると、2^x3^y=2^23^4=4\times81=324 となるため条件を満たします。 よって、Yes と出力してください。


入力例 2

5

出力例 2

No

どのような整数 x,y をとっても 2^x3^y=5 とすることはできません。 よって、No と出力してください。


入力例 3

32

出力例 3

Yes

x=5,y=0 とすると、2^x3^y=32\times1=32 となるため、Yes と出力してください。


入力例 4

37748736

出力例 4

Yes

Score : 200 points

Problem Statement

You are given a positive integer N. If there are integers x and y such that N=2^x3^y, print Yes; otherwise, print No.

Constraints

  • 1\leq N\leq10^{18}
  • N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print a single line containing Yes if there are integers x and y that satisfy the condition, and No otherwise.


Sample Input 1

324

Sample Output 1

Yes

For x=2,y=4, we have 2^x3^y=2^23^4=4\times81=324, so the condition is satisfied. Thus, you should print Yes.


Sample Input 2

5

Sample Output 2

No

There are no integers x and y such that 2^x3^y=5. Thus, you should print No.


Sample Input 3

32

Sample Output 3

Yes

For x=5,y=0, we have 2^x3^y=32\times1=32, so you should print Yes.


Sample Input 4

37748736

Sample Output 4

Yes