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