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