import sys input = sys.stdin.readline n=int(input()) S=[1] for i in range(100): S.append(S[-1]*17) if n in S: print("Yes") else: print("No")