#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  bool f = true;
  long long int i;
  for (i = 0; i < a.length();) {
    if (a[i] == '1' && a[i + 1] == '4' && a[i + 2] == '4') {
      i += 3;
    } else if (a[i] == '1' && a[i + 1] == '4') {
      i += 2;
    } else if (a[i] == '1') {
      i++;
    } else {
      f = false;
      break;
    }
  }
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
