#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  bool ok = true;
  for (int i = 0; i < s.size(); i++) {
    if (i + 1 < s.size() && i + 2 < s.size() && s[i] == '1' &&
        s[i + 1] == '4' && s[i + 2] == '4')
      i += 2;
    else if (i + 1 < s.size() && s[i] == '1' && s[i + 1] == '4')
      i += 1;
    else if (s[i] != '1')
      ok = false;
  }
  ok == true ? cout << "YES" : cout << "NO";
  return 0;
}
