from functools import reduce



print(("Yes" if reduce(lambda a, b: (a+b)%9, list(map(int, eval(input()))), 0) == 0 else "No"))

n = eval(input())

 

if (sum(map(int, n))) % 9 == 0:

    print("Yes")

else:

    print("No")
from functools import reduce

print(
    (
        "Yes"
        if reduce(lambda a, b: (a + b) % 9, list(map(int, eval(input()))), 0) == 0
        else "No"
    )
)

n = eval(input())
if (sum(map(int, n))) % 9 == 0:
    print("Yes")
else:
    print("No")

-from functools import reduce - -print( -    ( -        "Yes" -        if reduce(lambda a, b: (a + b) % 9, list(map(int, eval(input()))), 0) == 0 -        else "No" -    ) -) +n = eval(input()) +if (sum(map(int, n))) % 9 == 0: +    print("Yes") +else: +    print("No")