#include <bits/stdc++.h>
using namespace std;
int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long i, diff, one = 0, four = 0, remain, four_div;
  string str;
  cin >> str;
  for (i = 0; i < str.size(); i++) {
    if (str[i] == '1' || str[i] == '4') {
    } else {
      cout << "NO";
      return 0;
    }
  }
  long long cnt = 0, element;
  if (str[0] != '1') {
    cout << "NO";
    return 0;
  }
  for (i = 0; i < str.size(); i++) {
    if (cnt == 3) {
      cout << "NO";
      return 0;
    }
    if (str[i] == '4')
      cnt++;
    else
      cnt = 0;
  }
  if (cnt >= 3) {
    cout << "NO";
  } else
    cout << "YES";
  return 0;
}
