#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l, i, c = 0;
  l = s.size();
  for (i = 0; i < l; i++) {
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      c += 3;
    } else if (s[i] == '1' && s[i + 1] == '4') {
      c += 2;
    } else if (s[i] == '1') {
      c += 1;
    }
  }
  if (l == c) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
