#include <bits/stdc++.h>
using namespace std;
string ulaz, jed = "1", dva = "14", tri = "144";
bool je[10];
int main() {
  cin >> ulaz;
  int l = ulaz.size();
  for (int i = 0; i < l; i++) je[i] = false;
  for (int i = 0; i < l; i++) {
    if (je[i] == true) continue;
    if (i + 2 < l) {
      string nov;
      nov = ulaz[i];
      nov += ulaz[i + 1];
      nov += ulaz[i + 2];
      if (nov == tri) {
        je[i] = true;
        je[i + 1] = true;
        je[i + 2] = true;
        i += 2;
        continue;
      }
    }
    if (i + 1 < l) {
      string nov;
      nov = ulaz[i];
      nov += ulaz[i + 1];
      if (nov == dva) {
        je[i] = true;
        je[i + 1] = true;
        i += 1;
        continue;
      }
    }
    if (ulaz[i] == jed[0]) {
      je[i] = true;
      continue;
    }
  }
  for (int i = 0; i < l; i++)
    if (je[i] == false) {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  return 0;
}
