AtCoder Beginner Contest 181
D
Hachi
AtCoder
⌀ 600
原题
← CE →
翻译中…

Problem Statement

翻译中…

Given is a digit sequence $S$ consisting of the digits from 1 through 9.

翻译中…

Takahashi, the bee, loves multiples of $8$.

翻译中…

He is trying to make a multiple of $8$ by permuting the digit sequence $S$.

翻译中…

Determine whether it is possible.

翻译中…

Constraints

翻译中…
  • $1 \leq |S| \leq 2 \times 10^5$
  • Each character of $S$ is one of the digits from 1 through 9.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

S

翻译中…

Output

翻译中…

If it is possible to make a multiple of $8$ by permuting the digit sequence $S$, print Yes; otherwise, print No.

翻译中…

样例

Input #1
1234
Output #1
Yes
For example, permuting $1234$ into $1432$ results in a multiple of $8$.
Input #2
1333
Output #2
No
There is no way to permute $1333$ into a multiple of $8$.
Input #3
8
Output #3
Yes
题目信息
题号
abc181_d
时间限制
2 s
内存限制
1024 MB

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