#include <bits/stdc++.h>
template <typename T>
inline T gcd(T a, T b) {
  T c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
template <typename T>
T lcm(T a, T b) {
  return b * (a / gcd(a, b));
}
template <typename T>
inline T pow2(T base, T n) {
  T ansp = 1;
  while (n) {
    if (n & 1) ansp *= base;
    n >>= 1;
    base *= base;
  }
  return ansp;
}
using namespace std;
bool sortbyf(const pair<pair<long long, long long>, long long> &a,
             const pair<pair<long long, long long>, long long> &b) {
  return a.first.first < b.first.first;
}
bool sortbys(const pair<long long, long long> &a,
             const pair<long long, long long> &b) {
  return a.first < b.first;
}
long long mat[11][101][101];
int main() {
  string s;
  cin >> s;
  if (s[0] == '1') {
    for (long long i = 0; i < s.size(); i++) {
      if (s[i] != '1' && s[i] != '4') {
        printf("NO\n");
        return 0;
      }
    }
    int f = s.find("444");
    if (f > -1) {
      printf("NO\n");
      return 0;
    }
  } else {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}
