#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long int INF = 2e18 + 10;
const int Mod = 1e9 + 7;
const int MAXN = 2e5 + 10;
const int N = 1e5 + 10;
string s;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != '1' && s[i] != '4') {
      cout << "NO" << endl;
      return 0;
    }
    if (s[i] == '1') continue;
    if (s[i] == '4') {
      if (i - 1 >= 0) {
        if (s[i - 1] == '1')
          continue;
        else {
          if ((i - 2) >= 0) {
            if (s[i - 2] == '1')
              continue;
            else {
              cout << "NO" << endl;
              return 0;
            }
          } else {
            cout << "NO" << endl;
            return 0;
          }
        }
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
