#include <bits/stdc++.h>
using namespace std;
int main() {
  string ch;
  cin >> ch;
  while (ch[0] == '1') {
    if (ch.find("144") == 0)
      ch.erase(0, 3);
    else if (ch.find("14") == 0) {
      ch.erase(0, 2);
    } else if (ch.find("1") == 0) {
      ch.erase(0, 1);
    }
  }
  if (ch.size() == 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
