def main(): n = int(input()) while not n % 17: n //= 17 return "Yes" if n == 1 else "No" print(main())