#include <bits/stdc++.h>
using namespace std;
string solve(string s) {
  int one, four;
  one = four = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '1') {
      ++one;
    } else if (s[i] == '4') {
      ++four;
    } else {
      return "NO";
    }
  }
  if (one < 1) {
    return "NO";
  }
  if (s[0] == '4') {
    return "NO";
  }
  if (s.find("444") != s.npos) {
    return "NO";
  }
  return "YES";
}
int main(void) {
  string n;
  while (cin >> n) {
    cout << solve(n) << endl;
  }
  return 0;
}
