D - Hachi Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 400

問題文

19 の数字のみからなる数字列 S が与えられます。

蜂の高橋くんは、 8 の倍数が好きです。

高橋くんは、数字列 S を並び替えて 8 の倍数を作ろうとしています。

8 の倍数を作れるかどうか判定してください。

制約

  • 1 \leq |S| \leq 2 \times 10^5
  • S の各文字は 19 のいずれか

入力

入力は以下の形式で標準入力から与えられる。

S

出力

数字列 S を並び替えて 8 の倍数を作れるなら Yes を、作れないなら No を出力せよ。


入力例 1

1234

出力例 1

Yes

例えば、 1234 を並べ替えて 1432 にすると 8 の倍数になります。


入力例 2

1333

出力例 2

No

1333 をどう並べ替えても 8 の倍数を作ることはできません。


入力例 3

8

出力例 3

Yes

Score : 400 points

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.


Sample Input 1

1234

Sample Output 1

Yes

For example, permuting 1234 into 1432 results in a multiple of 8.


Sample Input 2

1333

Sample Output 2

No

There is no way to permute 1333 into a multiple of 8.


Sample Input 3

8

Sample Output 3

Yes