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