#include<bits/stdc++.h>
using namespace std;
int main(){
string a; cin >> a;
a = '0'+a+'0';
for(int i=1;i<a.size()-1;++i){
if(a[1] == '4' || (a[i] != '1' && a[i] != '4')){
cout << "NO";
return 0;
}else if(a[i] == '1') continue;
else{
if(a[i-1] == '1' || a[i+1] == '1') continue;
else if(a[i-1] == '4' && a[i+1] != '4') continue;
else if(a[i-1] != '4' && a[i+1] == '4') continue;
else{
cout << "NO";
return 0;
}
}
}
cout << "YES";
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglzdHJpbmcgYTsJY2luID4+IGE7CglhID0gJzAnK2ErJzAnOwoJZm9yKGludCBpPTE7aTxhLnNpemUoKS0xOysraSl7CgkJaWYoYVsxXSA9PSAnNCcgfHwgKGFbaV0gIT0gJzEnICYmIGFbaV0gIT0gJzQnKSl7CgkJCWNvdXQgPDwgIk5PIjsKCQkJcmV0dXJuIDA7CgkJfWVsc2UgaWYoYVtpXSA9PSAnMScpCWNvbnRpbnVlOwoJCWVsc2V7CgkJCWlmKGFbaS0xXSA9PSAnMScgfHwgYVtpKzFdID09ICcxJykJY29udGludWU7CgkJCWVsc2UgaWYoYVtpLTFdID09ICc0JyAmJiBhW2krMV0gIT0gJzQnKQljb250aW51ZTsKCQkJZWxzZSBpZihhW2ktMV0gIT0gJzQnICYmIGFbaSsxXSA9PSAnNCcpCWNvbnRpbnVlOwoJCQllbHNlewoJCQkJY291dCA8PCAiTk8iOwoJCQkJcmV0dXJuIDA7CgkJCX0KCQl9Cgl9Cgljb3V0IDw8ICJZRVMiOwoJcmV0dXJuIDA7Cn0=