p = input().strip() if not p.startswith('1'): print("No") else: if len(p) == 1: print("No") else: s = p[1:] reversed_s = s[::-1] current_carries = {0} for c in reversed_s: current_digit = int(c) new_carries = set() for carry_in in current_carries: for a in [6, 7]: for b in [6, 7]: total = a + b + carry_in mod = total % 10 if mod == current_digit: carry_out = total // 10 new_carries.add(carry_out) current_carries = new_carries if not current_carries: break if 1 in current_carries: print("Yes") else: print("No")