#include <bits/stdc++.h>
using namespace std;
void kick() {
  string s = "";
  char c;
  int cn = 0;
  c = getchar();
  while (c != ' ' && c != '\n') {
    s += c;
    if (c == '1') cn++;
    c = getchar();
  }
  if (cn == s.length()) {
    cout << "YES" << endl;
    return;
  }
  bool fl = true;
  int tm = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != '4' && s[i] != '1') {
      cout << "NO" << endl;
      fl = false;
      return;
    }
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      i += 2;
      continue;
    }
    if (s[i] == '1' && s[i + 1] == '4') {
      i++;
      continue;
    }
    if (s[i] == '1') continue;
    if (s[i] == '4') {
      fl = false;
      cout << "NO" << endl;
      break;
    }
  }
  if (fl) {
    cout << "YES" << endl;
  }
}
int main() { kick(); }
