#include <bits/stdc++.h>
using namespace std;
int main(void) {
  char sav[200];
  scanf("%s", sav);
  int flag = 0;
  int len = strlen(sav);
  for (int i = 0; i < len; i++) {
    if (sav[i] == '1')
      continue;
    else if (sav[i] == '4') {
      if (i - 1 >= 0 && sav[i - 1] == '1')
        continue;
      else if (i - 1 >= 0 && sav[i - 1] == '4') {
        if (i - 2 >= 0 && sav[i - 2] == '1')
          continue;
        else
          flag = 1;
      } else
        flag = 1;
    } else
      flag = 1;
  }
  if (flag)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
