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