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