#include <bits/stdc++.h>
int main() {
  char s[100];
  int i, kt = 0;
  scanf("%s", s);
  int l = strlen(s);
  for (i = 0; i < l; i++)
    if (s[i] == '1') {
      kt = 1;
      if (s[i + 1] == '4') {
        if (s[i + 2] == '4') {
          i = i + 2;
        } else
          i = i + 1;
      } else
        i = i;
    } else {
      kt = 0;
      break;
    }
  if (kt)
    printf("YES");
  else
    printf("NO");
  return 0;
}
