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