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