#include <bits/stdc++.h>
using namespace std;
bool is(const string& s) {
  if (s.find("444") != string::npos) {
    return false;
  }
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] != '1' && s[i] != '4') return false;
  }
  if (s[0] == '4') return false;
}
int main() {
  string s;
  cin >> s;
  if (is(s))
    cout << "YES";
  else
    cout << "NO";
}
