using System; using System.Collections.Generic; using System.Linq; using static System.Console; class Program { static void Main() { var p = ReadLine(); WriteLine(p[0] == '1' && '1' < p.Last() && p.Last() < '5' && p.Skip(1).Take(p.Length - 2).Select(x => '2' < x && x < '6' ? 0 : 1).Sum() == 0 ? "Yes" : "No"); } }