Problem:
 Score : 200 points    Problem Statement An integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9 .  Determine whether N is a multiple of 9 .      Constraints  0 \leq N < 10^{200000}  N is an integer.         Input Input is given from Standard Input in the following format:  N       Output If N is a multiple of 9 , print Yes ; otherwise, print No .        Sample Input 1 123456789      Sample Output 1 Yes  The sum of these digits is 1+2+3+4+5+6+7+8+9=45 , which is a multiple of 9 , so 123456789 is a multiple of 9 .       Sample Input 2 0      Sample Output 2 Yes       Sample Input 3 31415926535897932384626433832795028841971693993751058209749445923078164062862089986280      Sample Output 3 No

Solution (Python):
n = int(input())
total = sum(list(map(int, str(n))))

if total % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College

'''
from os import path
import sys
from heapq import heappush,heappop
from functools import cmp_to_key as ctk
from collections import deque,defaultdict as dd 
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools import permutations
from datetime import datetime
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input().rstrip()
def mi():return map(int,input().split())
def li():return list(mi())
abc='abcdefghijklmnopqrstuvwxyz'
mod=1000000007

inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]

def bo(i):
    return ord(i)-ord('a')

file=1




def solve():
    
    
    

    s = si()
    s1 = 0
    for i in s:
        s1 += int(i)

    print('Yes' if s1%9==0 else 'No')














        
if __name__ =="__main__":

    if(file):

        if path.exists('input.txt'):
            sys.stdin=open('input.txt', 'r')
            sys.stdout=open('output.txt','w')
        else:
            input=sys.stdin.readline
    solve()

Solution (Python):
n=input()

total=0
for i in n:
  total+=int(i)
  total=total%9

if total%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):








    






mod = int(1e9+7)

INF = 1<<50

def readInt():
    return list(map(int,input().split()))

def main():
    n = input()
    res = 0
    for i in range(len(n)):
        res += int(n[i])
    if res%9==0:
        print("Yes")
    else:
        print("No")
    return

if __name__=='__main__':
    main()

Solution (Python):
def main():
    n = list(input())
    n = list(map(int, n))
    if sum(n) % 9 == 0:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    main()

Solution (Python):
N= int(input())
if N%9 ==0:
    print("Yes")
else:
    print("No")

Solution (Python):
S = list(map(int,list(input())))
print("Yes" if sum(S)%9==0 else "No")

Solution (Python):
N = int(input())
if N % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
nine = 0
for i in s:
  nine += int(i)
if nine % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
a=n%9
if a==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()
Nsum = 0
for i in range(len(N)):
    Nsum += int(N[i])
if Nsum % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())

def digitSum(n):
    
    s = str(n)
    
    array = list(map(int, s))
    
    return sum(array)

if digitSum(n)%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()
count = 0

for i in range(len(N)):
  count += int(N[i])
  
if count % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
s = 0
for c in n:
  s += int(c)
print('Yes') if s % 9 == 0 else print('No')

Solution (Python):









def solve():
    n = input()
    t = 0
    for s in n:
        t += int(s)

    return ['Yes', 'No'][t % 9 != 0]


def main():
    print(solve())


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
if(n%9==0):
  print("Yes")
else:
  print("No")

Solution (Python):
n = input()
N = [0]*len(n)
for i in range(len(n)):
    N[i] = int(n[i])
if (sum(N) % 9) == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    r = sum([int(i) for i in n])
    res = "No"
    if r % 9 == 0:
        res = "Yes"
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = cin[0]

    cout = main(kwargs)
    print(cout)

Solution (Python):
n=int(input())
if n%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
s=raw_input()
p=0
for i in xrange(len(s)):
  p+=int(s[i])
if p%9==0:
  print "Yes"
else:
  print "No"

Solution (Python):
n = int(input())
if n % 9: print('No')
else: print('Yes')

Solution (Python):
n = input()
x = len(n)
q = 0
for i in range(x):
    q += int(n[i])
print("Yes" if q % 9 == 0 else "No")

Solution (Python):
n = input()

if sum([int(i) for i in n]) % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
def LI(): return list(map(int, input().split()))
def I(): return map(int, input().split())
mod = 10**9 + 7

def main():
  n = input()
  x = len(n)
  ans = 0
  for i in range(x):
    ans += int(n[i])
  if ans%9 == 0:
    print('Yes')
  else:
    print('No')
if __name__ == '__main__':
  main()

Solution (Python):
n=int(input())
if(n%9==0):
  print("Yes")
else:
  print("No")

Solution (Python):
import sys

Nstr = sys.stdin.readline().strip()

tmp = 0
for n_i in Nstr:
    tmp += int(n_i)

print("Yes" if tmp % 9 == 0 else "No")

Solution (Python):
print("Yes" if sum(map(int, list(input()))) % 9 == 0 else "No")

Solution (Python):





def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return x

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return x

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

def print_space(l):
    return print(" ".join([str(x) for x in l]))


import numpy as np




N = input()

Ns = str(N)

a = 0

for i in range(0,len(Ns)):
    a += int(Ns[i])

if a%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=input()
ans=0
for i in n:
    ans+=int(i)
if ans%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = [int(x) for x in input()]

if sum(N) % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
def main():
    print("Yes" if int(input())%9==0 else "No")
if __name__ == "__main__":
    main()

Solution (Python):
N = input()
sum = 0
for i in range(len(N)):
    sum += int(N[i])

if sum % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())

if n % 9 == 0:
	print('Yes')
else:
	print('No')

Solution (Python):
N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()
length = len(n)
num = 0
for i in range(length):
  num += int(n[i])
if num % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
if n%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()
n_sum = 0
for n in N:
    n_sum += int(n)
if n_sum % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
s = input()
n = len(s)

m = 0
for i in range(n):
    m += int(s[i])

if m%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
print("Yes" if int(input()) % 9 == 0 else "No")

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

if __name__ == "__main__":
    main()

Solution (Python):
number = input()

sum_digit = 0

for digit in number:
    sum_digit += int(digit)

ans = 'Yes' if (sum_digit % 9) == 0 else 'No'

print(ans)

Solution (Python):
import sys
N=sys.stdin.readline().strip()
t=0
for x in N:
    t+=int(x)
if t%9==0:
    print "Yes"
else:
    print "No"

Solution (Python):
N = input()
N = list(N)
N = list(map(int, N))
if sum(N)%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = input()
buf = 0
for i in range(len(N)) :
    buf += int(N[i])

if buf % 9 == 0 :
    print("Yes")
else :
    print("No")

Solution (Python):
n = input()
s = 0
for i in n:
  s += int(i)
if s%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):

from math import *

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

Solution (Python):
N_str = input()

sum_ = 0
for c in N_str:
    sum_ += int(c)

if sum_ % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
if N % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N=input()
res = 0
for i in N:
    res += int(i)
    
if res%9 == 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):
n = input()
s = 0
for i in n:
    s += int(i)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
s = 0
for n in input():
    s += int(n)
if s%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = list(input())

n = [int(s) for s in N]
if sum(n) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=input()
sum_N=0
for i in range(len(N)):
    sum_N+=int(N[i])
if sum_N%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = input()
counter = 0
for moji in n:
    counter += int(moji)
if counter % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
ans=chk=0
for i in s:
    chk+=int(i)%9
    chk%=9
print("Yes" if chk==0 else "No")

Solution (Python):
S = input()
wa = 0
for s in S:
    wa += int(s)
if wa % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
s = str(n)
sum=0
for i in range(len(s)):
    sum+=int(s[i])

if sum%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()
a = 0
for s in N:
    a+=(int(s)%9)
if a%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
S=input()
total=0
for i in S:
  total+=int(i)
if total%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
X = list(input())
Y = [int(i) for i in X]
ans = 0
for j in Y:
  ans += j
  ans %= 9
if ans == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
print(['No', 'Yes'][sum(int(c) for c in input()) % 9 == 0])

Solution (Python):
N = input()

sum = 0

for i in range(len(N)):
    sum += int(N[i])

if sum % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys,bisect

from sys  import stdin,stdout

from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right

from math import gcd,ceil,floor,sqrt

from collections import Counter,defaultdict,deque,OrderedDict

from queue import Queue,PriorityQueue

from string import ascii_lowercase

sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 998244353
mod = 10**9+7

def isPrime(n):
    
    if (n <= 1) :return False
    if (n <= 3) :return True
    if (n%2 == 0 or n%3 == 0):return False
    for i in range(5,ceil(sqrt(n))+1,6):
        if (n%i==0 or n%(i+2)==0):
            return False
    return True


def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")
    
def DFS(dictionary,vertex,visited):
    visited[vertex]=True
    stack=[vertex]
    print(vertex)
    while stack:
        a=stack.pop()
        for i in dictionary[a]:
            if not visited[i]:
                print(i)
                visited[i]=True
                stack.append(i)


def BFS(dictionary, vertex,visited):
    visited[vertex]=True
    q=deque()
    q.append(vertex)
    while q:
        a=q.popleft()
        for i in dictionary[a]:
            if not visited[i]:
                visited[i]=True
                q.append(i)
                print(i)

                


def soe(limit):
    l=[1]*(limit+1)
    l[0]=0
    l[1]=0
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0
    
    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n=input()
    s=sum(list(map(int,str(n))))
    if s%9==0:
        pr('Yes')
    else:
        pr('No')

    




for _ in range(1):
    solve()

Solution (Python):
n=input()
ct=0
for i in range(len(n)):
  ct+=int(n[i])
print("Yes" if ct%9==0 else "No")

Solution (Python):
n = list(input())

sum_n = 0
for i in range(len(n)):
    sum_n += int(n[i])

if sum_n % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()

res = 0
for x in N:
    res += int(x)

if res % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
if ans % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
S = input()
cnt = 0
for s in S:
    cnt += int(s)
if cnt % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s=input()
i=0
for x in s:
    i+=int(x)
print("Yes" if i%9==0 else "No")

Solution (Python):
n=input("")
s=0
for i in n:
    s+=int(i)
if(s%9==0):
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()

count = 0

for i in range(len(N)):
    count += int(N[i])

if count % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
if n%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = input()

s = 0
for i in range(len(N)):
    s += int(N[i])

if s % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
a = [int(i) for i in list(input())]
print('Yes' if sum(a) % 9 == 0 else 'No')

Solution (Python):
N = input()
c = 0
for n in N:
    c += int(n)
if c%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()


sum = 0

for s in N:
    sum += int(s)

if (sum % 9 == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
n=str(input())
ans=0
for i in range(len(n)):
    ans+=int(n[i])
    ans=ans%9
if ans==0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = list(input())

n = [int(s) for s in N]
if sum(n) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    N = map(int, input())
    if sum(N) % 9 == 0:
        return "Yes"
    else:
        return "No"

if __name__ == '__main__':
    print(main())

Solution (Python):
n = list(map(int, list(input())))
print('Yes' if sum(n)%9 == 0 else 'No')

Solution (Python):
def main():
    sm = 0
    N = input()
    for c in N:
        sm = (sm + int(c)) % 9
    if (sm == 0):
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
n = int(input())
if n%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
N=int(input())
if(N%9==0):
  print("Yes")
else:
  print("No")

Solution (Python):
print('NYoe s'[sum([int(i) for i in input()])%9==0::2])

Solution (Python):
n = input()

hoge = 0
for ele in n:
    num = int(ele)
    hoge += num
    
if hoge%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n=input()
chk=0
for i in range(len(n)):
  chk+=int(n[i])
print("Yes" if chk%9==0 else "No")

Solution (Python):
n=input()
p=0
for i in n:
    p+=int(i)
if(p%9==0):
    print('Yes')
else:
    print("No")

Solution (Python):
s=input()
ans=0
for i in range(len(s)):
  ans+=int(s[i])
if ans%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n=input()
sn=sum(map(int,list(n)))
print("Yes" if sn%9==0 else "No")

Solution (Python):

import sys

input = sys.stdin.readline


def Y():
    print("Yes")


def N():
    print("No")


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


n = S()

ans = 0
for s in list(n):
    ans += int(s)

if ans % 9 == 0:
    Y()
else:
    N()

Solution (Python):
n = int(input())
if n % 9 == 0 :
  print("Yes")
else :
  print("No")

Solution (Python):
n = input()

ans = 0
for i in range(len(n)):
    ans += int(n[i])

if ans%9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = str(input())

x = 0

for i in range(len(N)):
    x += int(N[i])
    
if x % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
s=list(input())
s=list(map(int,s))
if sum(s)%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
a = int(input())

s = str(a)

ls = len(s)

x = list(s)

res =0

for i in range(ls):
    res += int(x[i])

if res % 9 ==0:
    print("Yes")
    
else:
    print("No")

Solution (Python):
N = input()

ans = 0
for n in N:
    ans += int(n)%9

print('Yes' if ans % 9 == 0 else 'No')

Solution (Python):
import sys
input =sys.stdin.readline

N=list(input().rstrip('\n'))
n = [int(x) for x in N]
if sum(n)%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = list(input())
N = list(map(int, N))
if sum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = str(input())
tmp = 0
x = 0
for i in range(len(N)):
  x = int(N[i])
  tmp += x
if tmp%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())

if n % 9 == 0:
    print('Yes') 
else:
    print('No')

Solution (Python):
N = tuple(map(int, input()))
s = sum(N)
if s % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()
t = 0

for c in N:
    t += int(c)

if t % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=list(input())
sum=0
for i in N:
    sum+=int(i)

if sum%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = list(map(int, list(input())))

if sum(n) % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    N = readstr()
    c = 0
    for n in N:
        c += int(n)
    print("Yes" if not c % 9 else "No")


if __name__ == "__main__":
    main()

Solution (Python):
n = input()
su = 0
for i in n:
    su += int(i)
print("Yes") if su%9==0 else print("No")

Solution (Python):
N = input()
q = 0
for n in N:
    q += int(n)
print('No' if q % 9 else 'Yes')

Solution (Python):




import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    
    
    
    ss=readline().rstrip()
    n=0
    for s in ss:
        n+=int(s)
    
    if n%9 == 0:
        print("Yes")
    else:
        print("No")

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

Solution (Python):
N = [int(n) for n in list(input())]

if sum(N) % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
x = 0
for i in range(len(n)):
    x += int(n[i])%9
print('Yes' if (x%9)==0 else 'No')

Solution (Python):
s=input()
c=0
for i in s:
    i=int(i)
    c+=i
if c%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = list(map(int, list(input())))
if sum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = input()
res = 0
for i in n:
    res += int(i)
print('Yes' if res%9 == 0 else 'No')

Solution (Python):
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors


n = input()
ans = 0
for i in n:
    ans = ans%9 + int(i)
if ans%9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
n=input()

N=len(n)
total=0
for i in range(N):
    total+=int(n[i])

if total%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
nlist = list(map(int, input().split()))

if sum(nlist)%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = input()

s = 0

for n in N:
    s += int(n)

s = str(s)
s2 = 0

for n in s:
    s2 += int(n)

if s2%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = list(map(int, input()))

if sum(N) % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):

import math
from operator import mul
from functools import reduce
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)




def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N = S()
sum_ = 0
for n in N:
    sum_ += int(n)
if (sum_ % 9 == 0):
    print('Yes')
else:
    print('No')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, atan2, degrees
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = [int(i) for i in input()]
    if sum(N)%9 == 0:
        print("Yes")
    else:
        print(("No"))



if  __name__=='__main__':
    main()

Solution (Python):
N = list(input())
for i in range(len(N)):
    N[i] = int(N[i])

if(sum(N)%9==0):
    print("Yes")
else:
    print("No")

Solution (Python):








def solve(N):
    S = 'aaa'
    x = 0
    for n in N:
        x += int(n)
    print('Yes' if x % 9 == 0 else 'No')


if __name__ == '__main__':
    
    N = input()
    
    
    
    solve(N)

Solution (Python):
n = input()
t = sum(map(int, list(n)))
if t%9 == 0 :
    print("Yes")
else :
    print("No")

Solution (Python):

import sys
import numpy as np

YES = "Yes"  
NO = "No"  


def solve(N: str):
    sum = 0
    for d in list(N):
        sum += int(d)

    if sum%9==0:
        print(YES)
    else:
        print(NO)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = next(tokens)  
    solve(N)

if __name__ == '__main__':
    main()

Solution (Python):
n = input()
sum = 0
for i in range(len(n)):
	sum = sum + int(n[i])%9
if sum%9 == 0:
	print('Yes')
else:
	print('No')

Solution (Python):
N = int(input())
if(N%9==0):
    print('Yes')
else:
    print('No')

Solution (Python):
n=input()
mod=0
for i in range(len(n)):
  a=int(n[i])
  mod+=a%9

if mod%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):

n = map(int, input())

if sum(n) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


s = data()
answer = 0
for i in s:
    answer += int(i)
    answer %= 9
if answer == 0:
    out("Yes")
    exit()
out("No")

Solution (Python):
N_str = list(input())
N = [int(x) for x in N_str]

if sum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = S()
A = []
for i in range(len(N)):
    A.append(int(N[i]))
ans = sum(A)
if ans % 9 == 0:
    print('Yes')
else:
    print('No')