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