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