#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int i, c = 0;
  for (i = 0; i < s.size(); i++) {
    if (s[0] != '1') {
      c = 1;
      break;
    } else if (s[i] == '0' || s[i] == '2' || s[i] == '3' || s[i] == '5' ||
               s[i] == '6' || s[i] == '7' || s[i] == '8' || s[i] == '9') {
      c = 1;
      break;
    } else if (s[i] == '4' && s[i + 1] == '4' && s[i + 2] == '4') {
      c = 1;
    }
  }
  if (c) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}
