p=input() pi=int(p) le=len(p) boo=True k=['3','4','5'] l=['2','3','4'] if(p[0]=='1'): for i in range(1,le-1): if(not p[i] in k): boo=False break if(not p[le-1] in l): boo=False elif(le==1): boo=False elif(p[0] in ['6','7','8']): i=1 while(p[i]=='6' or p[i]=='7'): i+=1 if(i==le-1): boo=False break if(p[i] in k or p[i]=='8'): for j in range(i+1,le-1): if(not p[j] in k): boo=False break if(not p[le-1] in l): boo=False else: boo=False else: boo=False if(boo==True): print('Yes') else: print('No')