#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const double pi = acos(-1.0);
const double eps = 1e-11;
const int MAXI = 0x7fffffff;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const char dz[] = "SENW";
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
void debugarr(int* arr, int n) {
  cout << "[";
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "]" << endl;
}
int a[1000010];
char str[1000010];
int main() {
  int n, i, j, k, l, m, t, s = 0;
  cin >> str;
  m = strlen(str);
  for (i = 0; i < m; i++) {
    if (str[i] == '1') {
      if (str[i + 1] == '4' && i + 1 < m) {
        if (str[i + 2] == '4' && i + 2 < m) {
          i = i + 2;
        } else
          i += 1;
      }
    } else {
      printf("NO\n");
      return (0);
    }
  }
  printf("YES\n");
  return (0);
}
