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