#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s = to_string(n);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1' and s[i + 1] == '4' and s[i + 2] == '4') {
      s[i] = 'a';
      s[i + 1] = 'a';
      s[i + 2] = 'a';
      i += 2;
    } else if (s[i] == '1' and s[i + 1] == '4') {
      s[i] = 'a';
      s[i + 1] = 'a';
      i += 1;
    } else if (s[i] == '1') {
      s[i] = 'a';
    }
  }
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != 'a') {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
