#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 10;
vector<int> ans;
int main() {
  string s;
  cin >> s;
  int cnt1 = 0, cnt4 = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1') {
      cnt1++;
      cnt4 = 0;
    } else if (s[i] == '4' && cnt1) {
      cnt4++;
      if (cnt4 > 2) {
        cout << "NO";
        return 0;
      }
      if (cnt4 == 2) {
        cnt1 = 0;
      }
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
