#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int count = 0, i;
  string s;
  string a = "1", b = "14", c = "144";
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    string m, n, p;
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      count += 3;
      i += 2;
    } else if (s[i] == '1' && s[i + 1] == '4') {
      count += 2;
      i++;
    } else if (s[i] == '1') {
      count++;
    }
  }
  if (count == s.size())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
