#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.set_int_max_str_digits(10**6) # %% P = int(read()) # %% def solve(P): if P % 10 not in [2, 3, 4]: return False while P: P, r = divmod(P, 10) if r in [2, 3, 4]: P -= 1 continue if not P: return False if r in [6, 7]: return P == 0 or all(x in '67' for x in str(P)) return False return True # %% print('Yes' if solve(P) else 'No')