PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#SP0000021. Số chỉ có thừa số 2 và 3 (3-smooth Numbers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số chỉ có thừa số 2 và 3 (3-smooth Numbers)

3-smooth Numbers

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

A positive integer NN is 3-smooth if integers x,yx,y exist with N=2x3yN=2^x3^y. For positive integer NN, this is equivalent to having no prime factors besides 22 and 33. The exponents may be zero, so 1=20301=2^03^0 is valid. Determine whether NN has this form.

Input

One line contains positive integer NN.

Output

Print Yes if N=2x3yN=2^x3^y for suitable exponents, or No otherwise.

Subtasks

  • Subtask 1 (20 points): 1≤N≤10001\le N\le 1000.
  • Subtask 2 (30 points): 1≤N≤10000000001\le N\le 1000000000.
  • Subtask 3 (50 points): 1≤N≤10000000000000000001\le N\le 1000000000000000000.

Examples

Input

324

Output

Yes

Explanation

We have 324=4⋅81=22⋅34324=4\cdot81=2^2\cdot3^4; choose x=2,y=4x=2,y=4 and print Yes.

Input

5

Output

No

Explanation

The prime factor 55 is neither 22 nor 33, so the required representation does not exist. Print No.

Input

1

Output

Yes

Explanation

Set x=y=0x=y=0. Then 20⋅30=12^0\cdot3^0=1, so print Yes.