#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  cin >> n;
  int flag = 0;
  while (flag == 0 && n != 0) {
    if ((n % 10) == 1)
      n = n / 10;
    else if ((n % 10) == 4) {
      if (((n / 10) % 10) == 1)
        n = n / 100;
      else if (((n / 10) % 10) == 4) {
        if (((n / 100) % 10) == 1)
          n = n / 1000;
        else
          flag = 1;
      } else
        flag = 1;
    } else
      flag = 1;
  }
  if (flag == 1)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
