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