#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[15];
  int cnt = 0;
  cin >> str;
  for (int i = 0; i <= strlen(str) - 1; i++) {
    if (str[i] == '1' && str[i + 1] != '4')
      cnt++;
    else if (str[i] == '1' && str[i + 1] == '4' && str[i + 2] != '4')
      cnt += 2;
    else if (str[i] == '1' && str[i + 1] == '4' && str[i + 2] == '4')
      cnt += 3;
  }
  if (cnt == strlen(str))
    cout << "YES\n";
  else
    cout << "NO\n";
}
