#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '1') continue;
    if (s[i] == '4' && s[i - 1] == '1') continue;
    if (s[i] == '4' && i > 1 && s[i - 1] == '4' && s[i - 2] == '1') continue;
    return cout << "NO", 0;
  }
  cout << "YES";
}
