#include <bits/stdc++.h>
using namespace std;
inline void print(int pt) { printf("%d\n", pt); }
inline void print(long long pt) { printf("%I64d\n", pt); }
inline void print(double pt) { printf("%f\n", pt); }
inline void print(char pt[]) { printf("%s\n", pt); }
inline void scan(int &pt) { scanf("%d", &pt); }
inline void scan(long long &pt) { scanf("%I64d", &pt); }
inline void scan(double &pt) { scanf("%f", &pt); }
inline void scan(char pt[]) { scanf("%s", pt); }
struct pii {
  int a;
  int b;
  friend int operator<(pii a, pii b) {
    if (a.a != b.a) return a.a < b.a;
    return a.b < b.b;
  }
} p[500];
int n;
char stra[10000];
char strs[3][50] = {"144", "14", "1"};
int main() {
  scan(stra);
  int lena = strlen(stra);
  for (int i = 0; i < lena;) {
    if (stra[i] == '1') {
      if (i == lena - 1) break;
      if (stra[i + 1] == '4') {
        if (i + 1 == lena - 1) break;
        if (stra[i + 2] == '4') {
          if (i + 2 == lena - 1) break;
          i += 3;
          continue;
        }
        i += 2;
        continue;
      }
      i++;
      continue;
    } else {
      print("NO");
      return 0;
    }
  }
  print("YES");
  return 0;
}
