def solve(p): def No(): nonlocal ans ans = "No" #print("No") #exit() if all(ai=="6" or ai=="7" for ai in p): return "No" p = "0"+p c = 0 fin = 0 ans = "Yes" L = len(p) for j in range(L)[::-1]: i = int(p[j]) if c==0: if i==0: if j == 0: break else: No() if i == 6 or i == 7: fin = 1 c = 0 elif i == 2 or i == 3 or i == 4: if fin: No() c = 1 else: No() elif c==1: if i==1: if j==1: c = 0 break else: No() elif i == 7 or i == 8: fin = 1 c = 0 elif i == 3 or i == 4 or i == 5: if fin: No() c = 1 else: No() return ans q = [6,7] for i in q: if i > 10000: break q += [i*10+6,i*10+7] def guchoku(p): L = len(p) p = int(p) for i in q: for j in q: if i+j==p: return "Yes" return "No" p = input() print(solve(p))