p = input() l = list(map(int,list(p))) import sys if len(l) == 1: print('No') exit() n = 'No' y = 'Yes' if 2 <= l[-1] <= 4: pass else: print(n) exit() if l[0] == 1: for i in l[1:-1]: if 3 <= i <= 5: pass else: print(n) exit() print(y) exit() if p.count('8') >= 2: print(n) exit() if p.count('8') == 1: i = 0 while l[i] != 8: if l[i] != 6 and l[i] != 7: print(n) exit() i += 1 i += 1 for j in range(i,len(l)-1): if 3 <= l[j] <= 5: pass else: print(n) exit() print(y) exit() a = p.count('6') + p.count('7') if a == 0: print(n) exit() for i in range(a): if l[i] != 6 and l[i] != 7: print(n) exit() if l[a-1] == 6: print(n) exit() for j in range(a,len(l)-1): if 3 <= l[j] <= 5: pass else: print(n) exit() print(y)