Codeforces Round 189 (Div. 2)
A
Magic Numbers
Codeforces
900
原题
←B →
翻译中…

A magic number is a number formed by concatenation of numbers $1$, $14$ and $144$. We can use each of these numbers any number of times. Therefore $14144$, $141414$ and $1411$ are magic numbers but $1444$, $514$ and $414$ are not.

翻译中…

You're given a number. Determine if it is a magic number or not.

翻译中…

Input

翻译中…

The first line of input contains an integer $*n*$, $(1 ≤ *n* ≤ 10^{9})$. This number doesn't contain leading zeros.

翻译中…

Output

翻译中…

Print "YES" if $*n*$ is a magic number or print "NO" if it's not.

翻译中…

样例

Input #1
114114
Output #1
YES
InputCopy OutputCopy
Input #2
1111
Output #2
YES
InputCopy OutputCopy
Input #3
441231
Output #3
NO
InputCopy OutputCopy
题目信息
题号
320A
时间限制
2 s
内存限制
256 MB
标签
暴力
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。