import re def main(): P = input() ptn1 = '^1[3-5]+[2-4]$' ptn2 = '^[67]*[78][3-5]+[2-4]$' for ptn in (ptn1, ptn2): m = re.fullmatch(ptn, P) if m is not None: print('Yes') break else: print('No') main()