import sys input = sys.stdin.readline S=list(input().strip()) S.reverse() while S: if S and S[-1]=="6": S.pop() if S and S[-1]=="1": print("No") exit() continue if S[-1]=="7": if len(S)==1: S.pop() continue if S[-2]=="6" or S[-2]=="7" or S[-2]=="8": S.pop() continue S.pop() S.append("1") break if S[-1]=="8": S.pop() S.append("1") break break if len(S)==0: print("No") exit() while S: if len(S)==1: print("No") exit() x=S.pop() y=S.pop() if x=="1" and y=="2": continue if x=="1" and (y=="3" or y=="4"): if S: S.append("1") continue else: continue if x=="1" and y=="5": S.append("1") continue print("No") exit() print("Yes")