p = list(map(int, list(input()))) p.reverse() if not p[0] in (2, 3, 4): print('No') elif p[-1] == 1 and all([e in (3, 4, 5) for e in p[1:-1]]): print('Yes') elif p[-1] in (7, 8) and all([e in (3, 4, 5) for e in p[1:-1]]): print('Yes') elif p[-1] in (6, 7): if 8 in p and all([e in (3, 4, 5) for e in p[1:p.index(8)]]) and all([e in (6, 7) for e in p[p.index(8)+1:]]): print('Yes') elif 7 in p and all([e in (3, 4, 5) for e in p[1:p.index(7)]]) and all([e in (6, 7) for e in p[p.index(7)+1:]]): print('Yes') else: print('No') else: print('No')