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