#include <bits/stdc++.h>
using namespace std;
int main() {
  char n;
  bool ok = true;
  int cnt = 2;
  while (cin >> n) {
    if (n == '1')
      cnt = 0;
    else if (n == '4') {
      if (cnt == 2) ok = false;
      cnt++;
    } else
      ok = false;
  }
  puts(ok ? "YES" : "NO");
  return 0;
}
