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