#include <bits/stdc++.h>
using namespace std;
string s;
bool sol(int i) {
  if (i >= s.size()) return 1;
  int c1 = 0, c2 = 0, c3 = 0;
  if (s[i] == '1') c1 = sol(i + 1);
  if (s[i] == '1' && s[i + 1] == '4' && s[i + 2] == '4') c2 = sol(i + 3);
  if (s[i] == '1' && s[i + 1] == '4') c3 = sol(i + 2);
  return max(c1, max(c2, c3));
}
int main() {
  cin >> s;
  if (sol(0))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
