#include <bits/stdc++.h>
using namespace std;
const int oo = 1 << 30;
int main() {
  int n;
  cin >> n;
  int k = n;
  string s = "";
  while (k) {
    s += ('0' + (k % 10));
    k /= 10;
  }
  reverse(s.begin(), s.end());
  for (int i = 0; i + 2 < s.size(); i++) {
    string h = s.substr(i, 3);
    if (h == "144") {
      for (int k = i, j = 0; j < 3; j++, k++) s[k] = 'x';
    }
  }
  for (int i = 0; i + 1 < s.size(); i++) {
    string h = s.substr(i, 2);
    if (h == "14") {
      for (int k = i, j = 0; j < 2; j++, k++) s[k] = 'x';
    }
  }
  for (int i = 0; i < s.size(); i++) {
    string h = s.substr(i, 1);
    if (h == "1") {
      for (int k = i, j = 0; j < 1; j++, k++) s[k] = 'x';
    }
  }
  bool ok = true;
  for (int i = 0; i < s.size(); i++)
    if (s[i] != 'x') ok = false;
  if (ok)
    puts("YES");
  else
    puts("NO");
  return 0;
}
