#include <bits/stdc++.h>
using namespace std;
const long long int MAX = 1e5 + 5;
const long long int INF = 2e18;
int main() {
  long int n;
  cin >> n;
  int arr[10], i, j = 0, cnt4 = 1;
  while (n) {
    arr[j] = n % 10;
    n = n / 10;
    j++;
  }
  if (j > 1) {
    for (i = j - 1; i >= 0; i--) {
      if (arr[i] != 1 and arr[i] != 4) {
        cout << "NO" << endl;
        return 0;
      } else {
        if (arr[j - 1] == 4) {
          cout << "NO" << endl;
          return 0;
        }
        if (arr[i] == 4 && arr[i - 1] == 4) {
          cnt4++;
          if (cnt4 >= 3) {
            cout << "NO" << endl;
            return 0;
          }
        } else {
          cnt4 = 1;
        }
      }
    }
    cout << "YES" << endl;
  } else {
    if (arr[0] == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
