#include <bits/stdc++.h>
using namespace std;
bool magic(string s) {
  for (int i = 0; s[i]; i++) {
    if (s[i] != '1' && s[i] != '4') return false;
  }
  if (s[0] == '4') return false;
  if (s.find("444") != s.npos) return false;
  return true;
}
int main() {
  string number;
  cin >> number;
  bool ans = magic(number);
  if (ans)
    cout << "YES";
  else
    cout << "NO";
}
