#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s = to_string(n);
  int ans = 0, k = 0;
  if (s[0] == '1') {
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '1') {
        if (ans > 2) {
          k++;
          break;
        } else
          ans = 0;
      } else if (s[i] == '4')
        ans++;
      else {
        k++;
        break;
      }
    }
    if (k == 1 || ans > 2)
      cout << "NO";
    else
      cout << "YES";
  } else
    cout << "NO";
  cout << endl;
}
