#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  getline(cin, s);
  int i = 0, len;
  len = s.length();
  if (s[0] != '1')
    cout << "NO";
  else {
    for (i = 1; i < len; i++) {
      if (s[i] != '4' && s[i] != '1') {
        cout << "NO";
        break;
      }
      if (s[i] == '4') {
        if (s[i - 1] == '1' || s[i - 2] == '1')
          continue;
        else
          cout << "NO";
        break;
      }
    }
  }
  if (i == len) cout << "YES";
  return 0;
}
