#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, c, ans = 0;
  string s;
  cin >> s;
  bool sol = 1;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      i += 2;
      continue;
    }
    if (s[i] == '1' || (s[i] == '4' && s[i - 1] == '1'))
      continue;
    else
      sol = 0;
  }
  if (sol)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
