#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int flag = 1;
  cin >> str;
  int len = str.size();
  str[len] = '1';
  str[len + 1] = '1';
  for (int i = 0; i < str.size();) {
    string temp = "";
    if (str[i] == '1') {
      temp = str[i + 1];
      if (temp == "4") {
        temp += str[i + 2];
        if (temp == "44") {
          i += 3;
        } else {
          i += 2;
        }
      } else {
        i++;
      }
    } else {
      flag = 0;
      break;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
