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