/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.08 19:03:31 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; bool f(string s,bool ok = false) { if (s == "0") return true; if (s[s.size()-1] == '6' || s[s.size()-1] == '7') { for (int i = 0; i < s.size()-1; i++) { if (s[i] != '6' && s[i] != '7') { return false; } } return ok; } if (s.size() == 1) return false; if (s[s.size()-1] == '2' || s[s.size()-1] == '3' || s[s.size()-1] == '4') { if (s[s.size()-2] == '0') return false; s.pop_back(); s[s.size()-1]--; return f(s,true); } return false; } int main() { string s;cin >> s; if (f(s)) { puts("Yes"); } else { puts("No"); } return 0; }