#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> str;
  for (int i = 0; i <= str.size() - 1; i++) {
    if (str[i] == '1' || (str[i] == '4' && i > 0 && str[i - 1] == '1') ||
        (str[i] == '4' && i > 1 && str[i - 1] == '4' && str[i - 2] == '1')) {
      continue;
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
