#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  cout << t;
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const int mod = 1000000007;
void io_set() {}
void solve() {
  string s;
  cin >> s;
  bool flag = true;
  for (int i = 0; i < s.size(); i++) {
    if (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')
      ;
    else {
      flag = false;
    }
  }
  cout << (flag ? "YES" : "NO") << '\n';
}
signed main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
