#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool magic = true;
  int i = 0;
  while (i < s.length()) {
    if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') {
      i += 3;
    } else if (s[i] == '1' && s[i + 1] == '4') {
      i += 2;
    } else if (s[i] == '1') {
      i += 1;
    } else {
      magic = false;
      break;
    }
  }
  if (magic)
    cout << "YES";
  else
    cout << "NO";
}
