#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[11];
  scanf("%s", a);
  int n = strlen(a);
  int f = 0;
  for (int i = 0; i < n;) {
    if (a[i] == '1') {
      if (i + 1 < n and a[i + 1] == '4') {
        if (i + 2 < n and a[i + 2] == '4') {
          i += 3;
        } else {
          i += 2;
        }
      } else {
        i += 1;
      }
    } else {
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
