#include <bits/stdc++.h>
char ch[15];
int main() {
  int i, j, len;
  while (gets(ch)) {
    len = strlen(ch);
    for (i = 0; i < len; i++) {
      if (ch[i] != '1' && ch[i] != '4')
        break;
      else if (!(ch[i] == '1' || (ch[i] == '4' && i > 0 && ch[i - 1] == '1') ||
                 (ch[i] == '4' && i > 1 && ch[i - 1] == '4' &&
                  ch[i - 2] == '1')))
        break;
    }
    if (i != len)
      puts("NO");
    else
      puts("YES");
    memset(ch, 0, sizeof(ch));
  }
  return 0;
}
