#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int f = 0;
  for (long long int i = 0; i < s.length(); i++) {
    if (s[i] == '1') f = 1;
    if (s[i] != '1' && s[i] != '4') {
      cout << "NO" << endl;
      return 0;
    }
    if (s[i] == '4' && s[i + 1] == '4' && s[i + 2] == '4') {
      cout << "NO" << endl;
      return 0;
    }
    if (s[i] == '4' && s[i + 1] == '4' && f == 0) {
      cout << "NO" << endl;
      return 0;
    }
    if (s[i] == '4' && f == 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
