#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  int test = 0;
  cin >> num;
  bool mg = true;
  while (num != 0) {
    int dic = num % 10;
    num = num / 10;
    if (dic == 1) {
      test = 0;
    } else if (dic == 4 && test < 2) {
      test += 1;
    } else {
      mg = false;
    }
  }
  if (test != 0) {
    mg = false;
  }
  if (mg)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
