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