#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  regex r("^(1|14|144)*$");
  if (regex_match(s, r)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
