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