#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  if (s[0] != '1') {
    cout << "NO" << endl;
    return 0;
  }
  if (s.find("444") != string::npos) {
    cout << "NO" << endl;
    return 0;
  }
  for (auto c : s) {
    if (c != '1' && c != '4') {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
