lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end def error puts "No" exit end s = read_line.chars.map(&.to_i).reverse n = s.size a = Array.new(n, 0) n.times do |i| if s[i] == 0 a[i] = 0 elsif 2 <= s[i] <= 4 a[i] = 1 error if i == n - 1 || s[i + 1] == 0 s[i + 1] -= 1 elsif 6 <= s[i] <= 7 a[i] = 2 else error end end error if !a.join.match(/^1+2*0?$/) puts "Yes"