#include <bits/stdc++.h>
int main() {
  int a, b, c;
  char s[100];
  gets(s);
  a = 0, b = 0, c = 0;
  while (s[a] != '\0') {
    if (s[a] == '1')
      b = 1;
    else if (b == 0) {
      c = 1;
      break;
    } else if (b <= 2 && s[a] == '4')
      b++;
    else if (s[a] != 1)
      c = 1;
    else
      b = 1;
    a++;
  }
  if (c == 0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
