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