#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int i = 0, x = s.length();
  while (i < x) {
    if (s.substr(i, 3) == "144") {
      i += 3;
    } else if (s.substr(i, 2) == "14") {
      i += 2;
    } else if (s[i] == '1') {
      i++;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
