import sys

sys.setrecursionlimit(10**7)

read = sys.stdin.read

readlines = sys.stdin.readlines

from math import ceil

def main():

    n = list(map(int, input().split()))

    s9 = sum(n)

    if s9 % 9 == 0:

        print('Yes')

    else:

        print('No')



if __name__ == '__main__':

    main()
import sys

read = sys.stdin.read

#readlines = sys.stdin.readlines

from math import ceil

def main():

    n = tuple(map(int, tuple(eval(input()))))

    if sum(n) % 9 == 0:

        print('Yes')

    else:

        print('No')



if __name__ == '__main__':

    main()
import sys

sys.setrecursionlimit(10**7)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil


def main():
    n = list(map(int, input().split()))
    s9 = sum(n)
    if s9 % 9 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
# readlines = sys.stdin.readlines
from math import ceil


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


if __name__ == "__main__":
    main()

-sys.setrecursionlimit(10**7) -readlines = sys.stdin.readlines +# readlines = sys.stdin.readlines -    n = list(map(int, input().split())) -    s9 = sum(n) -    if s9 % 9 == 0: +    n = tuple(map(int, tuple(eval(input())))) +    if sum(n) % 9 == 0: