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