#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long int n, l;
  l = s.size();
  for (long long int i = 0; i < l; i++) {
    if ((s[i] != '1' && s[i] != '4') || s[0] == '4') {
      cout << "NO" << endl;
      return 0;
    } else if (s[i] == '4' && s[i + 1] == '4' && s[i + 2] == '4') {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
