#include <bits/stdc++.h>
using namespace std;
void Solve();
int main() {
  Solve();
  return 0;
}
void Solve() {
  string str;
  cin >> str;
  bool bol = true;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != '1' && str[i] != '4') {
      bol = false;
      break;
    } else if (str[0] != '1') {
      bol = false;
      break;
    } else if (str.find("444") != -1) {
      bol = false;
      break;
    }
  }
  if (bol)
    cout << "YES\n";
  else
    cout << "NO\n";
}
