#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  int p = 0;
  int x;
  while (n) {
    x = n % 10;
    if (x != 4 && x != 1) return (cout << "NO", 0);
    if (x == 4) p++;
    if (p > 2) return (cout << "NO", 0);
    if (x == 1) p = 0;
    n /= 10;
  }
  if (p == 0)
    cout << "YES";
  else
    cout << "NO";
  return (0);
}
