#include <bits/stdc++.h>
using namespace std;
bool solve(string s, int p) {
  if (s[p] == '\0') {
    return true;
  }
  for (int i = p; i < (int)s.length(); i++) {
    string t = s.substr(p, i - p + 1);
    if (t == "1" || t == "14" || t == "144") {
      if (solve(s, i + 1)) {
        return true;
      }
    } else {
      return false;
    }
  }
  return false;
}
int main() {
  string s;
  cin >> s;
  if (solve(s, 0)) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
