#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i < s.length(); i++) {
    if (i < (s.length() - 2) && s[i] == '1' && s[i + 1] == '4' &&
        s[i + 2] == '4') {
      i += 2;
      continue;
    } else if (i < (s.length() - 1) && s[i] == '1' && s[i + 1] == '4') {
      i++;
      continue;
    } else if (s[i] == '1') {
      continue;
    } else {
      count++;
      break;
    }
  }
  if (count > 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
