#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  bool flg = 0;
  for (long long i = 0; i < s.size(); i++) {
    cerr << "i"
         << " is " << i << '\n';
    if (s[i] == '1') {
      if (i + 1 < s.size() and s[i + 1] == '4') {
        if (i + 2 < s.size() and s[i + 2] == '4')
          i = i + 2;
        else
          i++;
      }
    } else {
      flg = 1;
      break;
    }
  }
  if (flg)
    cout << "NO" << '\n';
  else
    cout << "YES" << '\n';
  return 0;
}
