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