P=list(map(int,list(input()))) def solve(): while P: if all(p==0 for p in P): return True if P[-1] in (2,3,4): P.pop() if not P: return False if P[-1]==0: return False P[-1]-=1 else: return all(p in (6,7) for p in P) return True if solve(): ans="Yes" else: ans="No" print(ans)