#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  while (cin >> s) {
    int i = 0;
    int len = s.length();
    while (i < len) {
      if (s[i] == '1') {
        if (s[i + 1] == '4') {
          if (s[i + 2] == '4') {
            i += 3;
          } else
            i += 2;
        } else
          i += 1;
      } else {
        cout << "NO" << endl;
        break;
      }
    }
    if (i == len) cout << "YES" << endl;
  }
  return 0;
}
