def after78(p): if p[-1] == "1": return len(p) == 1 while p: x = p.pop() if not x in "67": return False return True def main(): p = input() if len(p) == 1: return False p = list(p) # 一桁目は3, 4のどっちか if not p[-1] in "234": return False p.pop() while p: x = p.pop() if x == "1": return len(p) == 0 if x in "78": return after78(p) if not x in "345": return False return True # たぶんこここない if main(): print("Yes") else: print("No")