#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int flag = 0;
  for (long long int i = 0; i < s.length(); i++) {
    if (s[0] != '1') {
      cout << "NO";
      flag = 0;
      break;
    }
    if (s[i] != '1' && s[i] != '4') {
      cout << "NO";
      flag = 0;
      break;
    };
    if (s.find("444") != s.npos) {
      cout << "NO";
      flag = 0;
      break;
    };
    flag = 1;
  }
  if (flag == 1) cout << "YES";
  return 0;
}
