#include <bits/stdc++.h>
using namespace std;
const unsigned long long maxn = 2e6 + 10;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string v;
  cin >> v;
  for (long i = 0; i < v.size(); i++) {
    if (v[i] != '1' && v[i] != '4') {
      cout << "NO" << endl;
      return 0;
    }
  }
  if (v[0] != '1') {
    cout << "NO" << endl;
    return 0;
  }
  unsigned long long p = 0;
  for (long i = 1; i < v.size(); i++) {
    if (v[i] == '4' && v[i - 1] == '4') {
      if (v[i + 1] == '4') {
        cout << "NO" << endl;
        p = 1;
        return 0;
      }
    }
  }
  if (p == 0) {
    cout << "YES" << endl;
    return 0;
  }
}
