#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  bool flag = true;
  long long x;
  long long n = s.length();
  for (long long i = 0; i < n;) {
    if (s[i] == '1') {
      i++;
      if (s[i] == '4') {
        i++;
        if (s[i] == '4') {
          i++;
        }
      }
    } else {
      flag = false;
      break;
    }
  }
  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
