#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: int):
    S = str(S)
    c = [0]*10
    for si in S:
        c[int(si)]+=1
    
    if len(S) >=3:
        for p in range(112,1000, 8):
            p = str(p)
            p100 = int(p[0])
            p10 = int(p[1])
            p1 = int(p[2])

            c[p100]-=1
            c[p10]-=1
            c[p1]-=1

            if (0<= c[p100]) and (0<= c[p10]) and (0<= c[p1]):
                print(YES)
                return
            c[p100]+=1
            c[p10]+=1
            c[p1]+=1
    elif len(S) == 2:
        for p in range(16,104, 8):
            p = str(p)
            p10 = int(p[0])
            p1 = int(p[1])
            c[p10]-=1
            c[p1]-=1

            if (0<= c[p10]) and (0<= c[p1]):
                print(YES)
                return
            c[p10]+=1
            c[p1]+=1
    elif len(S) == 1:
        if int(S) == 8:
            print(YES)
            return
    print(NO)




    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()
