#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n;
  string str;
  cin >> str;
  n = str.length();
  for (i = 0; i < n; i++) {
    if (str[i] == '1') {
      if (str[i + 1] == '4' && i < n - 1) {
        if (str[i + 2] == '4' && i < n - 2)
          i += 2;
        else
          i++;
      }
    } else
      break;
  }
  if (i == n)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
