#include <bits/stdc++.h>
using namespace std;
bool isit(string s, int idx) {
  if (idx == s.length()) return true;
  if (s[idx] != '1')
    return false;
  else {
    bool b = isit(s, idx + 1);
    if (b)
      return true;
    else if (idx < int(s.length()) - 1) {
      if (s[idx + 1] == '4') {
        bool v = isit(s, idx + 2);
        if (v)
          return true;
        else if (idx < int(s.length()) - 2) {
          if (s[idx + 2] != '4')
            return false;
          else {
            bool z = isit(s, idx + 3);
            return z;
          }
        }
      } else
        return false;
    }
  }
}
void solve() {
  string s;
  cin >> s;
  bool b = isit(s, 0);
  if (b)
    cout << "YES";
  else
    cout << "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
}
