atcoder#ABC181D. [ABC181D] Hachi

[ABC181D] Hachi

Score : 400400 points

Problem Statement

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

Takahashi, the bee, loves multiples of 88.

He is trying to make a multiple of 88 by permuting the digit sequence SS.

Determine whether it is possible.

Constraints

  • 1S2×1051 \leq |S| \leq 2 \times 10^5
  • Each character of SS is one of the digits from 1 through 9.

Input

Input is given from Standard Input in the following format:

SS

Output

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

1234
Yes

For example, permuting 12341234 into 14321432 results in a multiple of 88.

1333
No

There is no way to permute 13331333 into a multiple of 88.

8
Yes