#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  string s = to_string(n);
  vector<long long> v1;
  int flag = 0;
  for (int i = 0; i < s.length(); i++) {
    v1.push_back(s[i] - '0');
    if (s[i] != '1' && s[i] != '4') {
      flag = 1;
      break;
    }
  }
  if (count(v1.begin(), v1.end(), 1) != v1.size()) {
    if (flag == 0) {
      int flag1 = 0;
      int i = 0;
      while (i <= v1.size() - 1) {
        if (v1[i] == 1 && v1[i + 1] == 1) {
          i++;
        } else if (v1[i] == 1 && v1[i + 1] == 4 && v1[i + 2] == 4) {
          i += 3;
        } else if (v1[i] == 1 && v1[i + 1] == 4 && v1[i + 2] != 4) {
          i += 2;
        } else if (v1[i] == 4) {
          flag1 = 1;
          break;
        } else {
          flag = 1;
          break;
        }
      }
      if (flag1 == 1 && i != v1.size()) {
        cout << "NO";
      } else {
        cout << "YES";
      }
    } else {
      cout << "NO";
    }
  } else {
    cout << "YES";
  }
  return 0;
}
