#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int n, i, k = 0;
  cin >> str;
  for (i = 0; i < str.size(); ++i) {
    if (str[0] != '1') {
      break;
    }
    if (str[i] != '1' && str[i] != '4') {
      break;
    }
    if (str[i] == '1') {
      k = 1;
    }
    if (str[i] == '4') {
      k++;
    }
    if (k > 3) {
      break;
    }
  }
  if (i == str.size()) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
}
