#include <bits/stdc++.h>
using namespace std;
int n, a[111], kol;
int main() {
  cin >> n;
  while (n) {
    a[kol++] = n % 10;
    if (a[0] == 1) {
      kol = 0;
      for (int i = 0; i < 111; i++) a[i] = 0;
    }
    if (a[0] == 4 && a[1] == 4 && a[2] == 1) {
      kol = 0;
      for (int i = 0; i < 111; i++) a[i] = 0;
    }
    if (a[0] == 4 && a[1] == 1) {
      kol = 0;
      for (int i = 0; i < 111; i++) a[i] = 0;
    }
    n = n / 10;
  }
  if (kol)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
