#include <bits/stdc++.h>
using namespace std;
int L, i, j;
string S;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> S;
  L = S.length();
  for (i = 0; i < L; i++) {
    if (S[i] != '1') {
      if (S[i] == '4') {
        if (i == 0) {
          cout << "NO\n";
          return 0;
        }
        if (S[i - 1] == '4' && S[i - 2] == '4') {
          cout << "NO\n";
          return 0;
        }
      } else {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
}
