using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = Reader.ReadLine().Reverse().Select(a=>int.Parse(a.ToString())).ToArray(); string ans = "No"; if(IsValid(inpt)) { ans = "Yes"; } Console.WriteLine(ans); } private bool IsValid(int[] inpt) { for (int i = 0; i < inpt.Length; i++) { int num = inpt[i]; if(i==0) { if(num >=2&&num<=4) { continue; } else { return false; } } else if(i == inpt.Length - 1) { if(num==1) { return true; } else { return false; } } else { if(num >= 3&&num<=5) { continue; } else if(num == 7 || num == 8) { for (int j = i + 1; j < inpt.Length; j++) { if(inpt[j] != 6 && inpt[j] != 7) { return false; } } return true; } else { return false; } } } return true; } public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 155555555555555555555555 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }