S = list(map(int, input()))[::-1] t = 2 n = len(S) S += [0, 0, 0, 0] for i in range(n): if S[i] == 0: break elif S[i] in [2, 3, 4]: if t == 1: print("No") exit() S[i] = 0 S[i + 1] -= 1 elif S[i] in [6, 7]: if i == 0: print("No") exit() t = 1 S[i] = 0 else: print("No") exit() if all(s == 0 for s in S): print("Yes") else: print("No")