#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const int M = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  LL n;
  cin >> n;
  LL cnt = 0, mx = 0;
  bool on = true;
  bool en = true;
  while (n != 0) {
    if (n % 10 == 4)
      cnt++;
    else
      cnt = 0;
    if (n % 10 != 4 && n % 10 != 1) on = false;
    mx = max(mx, cnt);
    if (n / 10 == 0) {
      if (n % 10 != 1) en = false;
    }
    n /= 10;
  }
  if (mx < 3 && on && en)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
