#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  int cnt4 = 0;
  while (N) {
    int cifra = N % 10;
    N = N / 10;
    if (cifra == 1) {
      cnt4 = 0;
      continue;
    }
    if (cifra == 4 && cnt4 < 2) {
      cnt4++;
      continue;
    }
    cout << "NO";
    return 0;
  }
  if (cnt4)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
