#include <bits/stdc++.h>
using namespace std;
long long int arr[100009];
int main() {
  int n, m, s, p, q, ans = 0;
  scanf("%d", &n);
  m = n;
  int dig, flag = 0;
  while (m != 0) {
    dig = m % 10;
    if (dig != 1 && dig != 4) {
      cout << "NO";
      return 0;
    }
    if (dig == 4) flag++;
    if (dig == 1) flag = 0;
    if (flag == 3) {
      cout << "NO";
      return 0;
    }
    m /= 10;
  }
  if (dig == 4) {
    cout << "NO";
    return 0;
  }
  cout << "YES";
}
