import sys input = sys.stdin.readline S=list(input().strip()) S.reverse() while S: if S and S[-1]=="6" or S[-1]=="7": S.pop() else: break if len(S)==0: print("Yes") 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")