#include <bits/stdc++.h>
using namespace std;
bool magical(string s) {
  for (int i = 0; i < s.size(); i++)
    if (s[i] != '1' && s[i] != '4') return false;
  if (s[0] == '4') return false;
  if (s.find("444") != string::npos) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  cout << (magical(s) ? "YES\n" : "NO\n");
}
