#include <bits/stdc++.h>
int main() {
  char s[1000001];
  int i, j, k, l, f = 1;
  scanf("%s", s);
  for (i = 0; i < strlen(s); i++) {
    if (s[0] != '1') {
      f = 0;
      break;
    } else if (s[i] != '1' && s[i] != '4') {
      f = 0;
      break;
    } else if (s[i] == '4' && s[i + 1] == '4' && s[i + 2] == '4') {
      f = 0;
      break;
    }
  }
  if (f == 0)
    printf("NO\n");
  else
    printf("YES\n");
}
