#include <bits/stdc++.h>
using namespace std;
bool is_magic(const std::string &x) {
  int a = 2;
  for (size_t i = 0; i < x.size(); ++i)
    if (x[i] == '1') {
      a = 0;
    } else if (x[i] == '4') {
      if (++a > 2) {
        return false;
      }
    } else {
      return false;
    }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  if (is_magic(s)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
