#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch;
  int st = 0;
  while (cin >> ch) {
    switch (ch) {
      case '1':
        st = 1;
        break;
      case '4':
        if (st == 3 || st == 0) {
          cout << "NO" << endl;
          return 0;
        } else
          ++st;
        break;
      default:
        cout << "NO" << endl;
        return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
