#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pll = pair<ll, ll>;
using vll = vector<ll>;
ll testcases;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  testcases = 1;
  while (testcases--) {
    string n;
    cin >> n;
    ll o = 0, f = 0, fail = 0;
    for (ll i = 0; i < n.size(); i++) {
      if (n[i] == '4') {
        ++f;
        if (f > 2)
          fail = 1;
        else if (o < 1)
          fail = 1;
      } else if (n[i] == '1')
        f = 0, o++;
      else if (n[i] != '1' || n[i] != '4')
        fail = 1;
    }
    if (!fail)
      cout << "YES";
    else
      cout << "NO";
  }
}
