p = input().strip() if p == '0': print("No") else: n = len(p) if n == 1: num = int(p) if num in {12, 13, 14}: print("Yes") else: print("No") else: reverse_p = p[::-1] m = len(reverse_p) dp = [dict() for _ in range(m + 1)] dp[0][(0, True, True)] = True for i in range(m): current_dp = dp[i] if not current_dp: continue for (c, a_h, b_h), _ in current_dp.items(): a_digits = [6, 7] if a_h else [0] b_digits = [6, 7] if b_h else [0] for a_d in a_digits: for b_d in b_digits: s = a_d + b_d + c digit_p = s % 10 carry_out = s // 10 if i < m and digit_p != int(reverse_p[i]): continue if i == m - 1 and carry_out != 0: continue a_h_next_options = [True, False] if a_h else [False] b_h_next_options = [True, False] if b_h else [False] for a_h_next in a_h_next_options: for b_h_next in b_h_next_options: key = (carry_out, a_h_next, b_h_next) dp[i + 1][key] = True if (0, False, False) in dp[m]: print("Yes") else: print("No")