#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  getline(cin, s);
  int l = s.length();
  int i = 0;
  for (; i < l;) {
    if (s[i] != '1')
      break;
    else {
      int step = 1;
      if (s[i + 1] == '4') {
        step++;
        if (s[i + 2] == '4') step++;
      }
      i += step;
    }
  }
  if (i == l)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
