#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  if (str[0] != '1') {
    puts("NO");
    return 0;
  }
  int cnt = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] != '1' && str[i] != '4') {
      puts("NO");
      return 0;
    }
    if (str[i] == '1')
      cnt = 0;
    else if (str[i] == '4')
      cnt++;
    if (cnt == 3) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}
