#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
using namespace std;
void vok() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
}
string func(string A, int n) {
  for (int i = 0; i < n; i++) {
    if (A[i] != '4' and A[i] != '1')
      return "NO";
    else if (i + 1 < n and i + 2 < n and A[i] == '1' and A[i + 1] == '4' and
             A[i + 2] == '4')
      i += 2;
    else if (i + 1 < n and A[i] == '1' and A[i + 1] == '4')
      i += 1;
    else if (A[i] == '1')
      continue;
    else
      return "NO";
  }
  return "YES";
}
int main() {
  vok();
  int t = 1;
  while (t--) {
    int n, m, a, b, c, d, x, y, k;
    string A;
    cin >> A;
    n = A.size();
    cout << func(A, n) << endl;
  }
  return 0;
}
