#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  int f, i;
  cin >> a;
  for (i = 0; i < a.length(); i++)
    if (a[i] != '1' and a[i] != '4') goto l;
  while ((f = a.find("144")) != -1) {
    for (i = f; i < f + 3; i++) a[i] = '*';
  }
  while ((f = a.find("14")) != -1) {
    for (i = f; i < f + 2; i++) a[i] = '*';
  }
  while ((f = a.find("1")) != -1) {
    for (i = f; i < f + 1; i++) a[i] = '*';
  }
  if (a.find("4") == -1)
    cout << "YES" << endl;
  else
    goto l;
  return 0;
l:
  cout << "NO" << endl;
  return 0;
}
