#include <bits/stdc++.h>
using namespace std;
int main() {
  string in;
  cin >> in;
  bool ok = 1;
  for (int i = 0; i < in.size(); i++) {
    if (in[i] != '1') {
      ok = 0;
      break;
    }
    int j = i + 1;
    int c = 0;
    while (j < in.size() && in[j] == '4') {
      j++;
      c++;
    }
    if (c > 2) {
      ok = 0;
      break;
    }
    i = j - 1;
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}
