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