#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, found = 1;
  ;
  string s;
  cin >> s;
  n = s.size();
  for (i = 0; i < n;) {
    if (s[i] == '2' || s[i] == '3' || s[i] == '5' || s[i] == '6' ||
        s[i] == '7' || s[i] == '8' || s[i] == '9') {
      found = 0;
      break;
    }
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      i += 3;
      found = 1;
      continue;
    }
    if (s[i] == '1' && s[i + 1] == '4') {
      i += 2;
      found = 1;
      continue;
    }
    if (s[i] == '1') {
      i += 1;
      found = 1;
      continue;
    } else {
      found = 0;
      break;
    }
  }
  if (found)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
