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 = input()
cnt = 0
for i in N:
	cnt += int(i)
print("Yes" if cnt % 9== 0 else "No")

Solution (Python):


n = str(input())
s = len(n)

t = 0

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

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

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

sum = sum(N)

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

Solution (Python):
N=list(input())
N_2=list(map(int,N))
print('YNeos'[sum(N_2)%9!=0::2])

Solution (Python):
a=input()

sum=0

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

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

Solution (Python):
import sys
from io import StringIO
import unittest
import math

def resolve():
    N, =  input().split()
    calc9(N)








def calc9(n):
    if len(n)==1:
        if n=='9' or n=='0':
            
            print("Yes")
        else:
            
            print("No")
    else:
        sum =0
        for s in n:
            sum=sum+int(s)
        calc9(str(sum))

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    
    
    
    
    
    def test_入力例_2(self):
        input = """0"""
        output = """Yes"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """31415926535897932384626433832795028841971693993751058209749445923078164062862089986280"""
        output = """No"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()

Solution (Python):
def getsum(N):

    sum = 0
    while(N != 0):
        sum = sum + int(N%10)
        N = int(N//10)

    return sum
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('YNeos'[int(input())%9>0::2])

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

Solution (Python):
N = input()

num = 0

for n in N:
  num += int(n)
  
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 = list(input())
N2 = list(map(int, N))

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

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

result=sum(list(map(int, str(N))))
if result%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()
t = sum(list(map(int, list(n))))


if int(t / 9) == t / 9:
    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):

import sys
sys.setrecursionlimit(1000000)
from collections import deque


N = int(input())






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

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

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

Solution (Python):
n = input()
suma = 0
for i in range(len(n)):
    suma += int(n[i])
if suma % 9 == 0:
    print("Yes")
else:
    print("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 = int(input())
N = str(n)
r = len(N)
ct = 0
for i in range(r):
    ct += int(N[i])

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

Solution (Python):
N = int(input())
s = 0

s = sum(list(map(int, str(N))))

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

Solution (Python):
a=input()
s=[int(s) for s in a]
b=sum(s)
if b%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())

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):
a = input()
s = int(a)
s = list(map(int, a))
b=int(a)


if b%9==0 or sum(s)%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())

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

Solution (Python):

from functools import reduce
stringN = input()
if len(stringN) == 1:
  sum = int(stringN)
else:
  sum = reduce(lambda a, b: int(a)+int(b), stringN)
if sum % 9 == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N=input()


A=[]
for i in range(len(N)):
  A.append(int(N[i:i+1]))

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

Solution (Python):
n=[int(x) for x in list(input())]
if sum(n)%9==0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
N = str(input())
le = len(N)
R = 0

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

Solution (Python):
import math
n=input()
ans=0
for item in n:
  ans+=int(item)
if ans%9==0:
  print("Yes")
else:
  print("No")

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 numpy as np
A = np.array(list(map(int,list(input()))))

print('Yes' if np.sum(A) % 9 == 0 else 'No')

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

Solution (Python):


n = int(input())

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

Solution (Python):
n = input()
n = [int(x) for x in n]
m = sum(n)
if m % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):



















"""fact=[1]












from sys import stdin, stdout
import bisect            
from bisect import bisect_left as bl              
from bisect import bisect_right as br             
import itertools
from collections import Counter
from math import sqrt
import collections
import math
import heapq
import re
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
  
def Divisors(n) : 
    l = []  
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                l.append(i) 
            else : 
                l.append(i)
                l.append(n//i)
    return l

def most_frequent(list):
    return max(set(list), key = list.count) 
def GCD(x,y):
    while(y):
        x, y = y, x % y
    return x

def ncr(n,r,p):                                              
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t

def Convert(string): 
    li = list(string.split("")) 
    return li 

def SieveOfEratosthenes(n): 
    global prime
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]: 
            f.append(p)
    return f
prime=[]
q=[]
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            
    return j









"""*******************************************************"""
def main():
    n=inin()
    if sum(list(map(int,str(n))))%9==0:
        print('Yes')
    else:
        print('No')

"""*******************************************************"""

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange
 
import os, sys
from io import IOBase, BytesIO
 
BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
 
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None
 
    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
 
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()
 
    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
if __name__== "__main__":
    main()

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

sum = 0
for n in N:
    sum += int(n)

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

Solution (Python):

"""
N : 数字文字列
Nは9の倍数か否か？
"""

N = list(input())
sum = 0

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

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

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

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

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

N = sum(N)

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

Solution (Python):


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

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

total = sum(list(map(int, str(N))))

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

Solution (Python):
N = input()
if sum(list(map(int, str(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())
k = len(N)
ans = 0
for i in range (k):
 n = int (N[i])
 ans = ans + n
if ans % 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()

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

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

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

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

wa = 0
for i in range(len(num)) : 
  wa += int(num[i])

amari = wa % 9

if amari == 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = input()

result = sum(list(map(int, str(N))))
if(result%9==0):
    print("Yes")
else:
    print("No")

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

Solution (Python):
N = input()
l = sum([int(x) for x in list(str(N))])
if l % 9 == 0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
n = input()
tmp = ord('0')
cul = 0
for i in n:
  cul += ord(i)-tmp
  cul = cul % 9
if(cul==0):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
N_sum = sum(map(int, str(N)))


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

Solution (Python):
N=int(input())
sum_of_digits = sum(int(digit) for digit in str(N))
if sum_of_digits%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):
N=input()
total=0
for i in range(len(N)):
  total+=int(N[i])
if total%9==0:
  print("Yes")
else:
  print("No")

Solution (Python):


import sys






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

Solution (Python):
N = input()
C = 0
for s in N:
    C += int(s)
if C % 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()

sum_=0
for ni in N:
    sum_ += int(ni)

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

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

Solution (Python):
N=int(input())
c = 0
if (N == 0):
    print("Yes")
else:
    num_list = list(str(N))
    s = len(num_list)
    for i in range(s):
        a = num_list[i]
        c += int(a) 
    if(c % 9 == 0):
        print("Yes")
    else:
        print("No")

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

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

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

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

Solution (Python):

_INPUT = """\
123456789
"""

def main():
    n = [int(i) for i in input()]

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


if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools

    
    main()

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

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

Solution (Python):
N = input()

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

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

Solution (Python):
n=int(input())
l=[int(x) for x in list(str(n))]
result=sum(l)
if result%9==0:
  print('Yes')
else:
  print('No')

Solution (Python):
n = input()
total = 0
if int(n) >= 0 and int(n) < 10**200000:
    for i in n:
        total = total + int(i)
    if total % 9 == 0:
        print("Yes")
    else:
        print("No")
else:
    print()

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

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

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

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

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

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

n = int(input()) 
if n == 0:
    print('Yes')
    exit()
while(True):
    n = digitSum(n)
    if len(str(n))==1:
        if n == 9:
            print('Yes')
        else:
            print('No')
        exit()

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

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

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

Solution (Python):
ｎum = int(input())

s = str(num)
array = list(map(int, s))
f = sum(array)

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

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

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

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

Solution (Python):
def is_multiple_of_nine(x):
    cnt = 0
    for c in str(x):
        cnt += int(c)
    return (cnt % 9) == 0
    
x = int(input())

if is_multiple_of_nine(x):
    print("Yes")
else:
    print("No")

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())


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

def main():
    N = I()
    dig_sum = digitSum(N)
    print("Yes" if dig_sum%9==0 else "No")

main()

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

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

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

Solution (Python):

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

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

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 sum(list(map(int, str(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 = input()
judge = 0

for i in N:
  judge = int(i) + judge 
  
if judge%9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
sumN = sum(int(digit) for digit in str(N))
if sumN%9 == 0:
    print("Yes")
else:
    print("No")

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


if __name__ == '__main__':
    abc176_b()

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

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

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

Solution (Python):
n = input()

num = [int(n[i]) for i in range(len(n))]

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

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

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

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

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

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

Solution (Python):
import sys
from sys import stdin,stdout
import math
import time
from functools import lru_cache
from collections import Counter
import heapq

try:
    for _ in range(1):
        N=int(input())
        if N%9==0:
            print("Yes")
        else:
            print("No")
except EOFError as e:
    print(e)

Solution (Python):
S = input()

while len(S) > 10:
    _sum = 0
    for n in S:
        _sum += int(n)
    S = str(_sum)

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

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

ans = 0
for s in input():
  ans += int(s)

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

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

Solution (Python):
N=int(input())
if N==0:
    print("Yes")
elif 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()
NN=list(N)


num=0
for s in NN:
	num=num+int(s)


if num % 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 = 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):

import sys
def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

n=reader()[0][0]
i=vfunc(lambda n:int(n))(n)
print('Yes' if sum(i)%9==0 else 'No')

Solution (Python):
N = input()

buf = 0
for x in range(0, len(N)):
    buf += int(N[x])
    if buf % 9 == 0:
        buf = 0


print("Yes" if buf == 0 else "No")

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 = list(input())
nine = [int(i) for i in N]
if sum(nine)%9 == 0:
    print("Yes")
else:
    print("No")

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

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

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

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

Solution (Python):

import math

num = input()
total = 0
num2 = list(num)
num_list = list(map(int, num2))
sum = sum(num_list)
if sum % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
if n % 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)

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

Solution (Python):
N = input().rstrip()

sum0 = 0

for s in N:
    sum0 = (sum0+int(s))%9
if sum0 == 0:
    print("Yes")
else:
    print("No")

Solution (Python):



N=input()
sum=0

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

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

Solution (Python):
X = input()
s = 0

for x in X:
    s = s + int(x)

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

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

Solution (Python):
if sum([int(s) for s in list(input().split())]) % 9 == 0:
  print("Yes")
else:
  print("No")

Solution (Python):
def solution(inp: str) -> str:
    total: int = 0
    for n in inp:
        total += int(n)
    if total % 9 == 0:
        return "Yes"
    else:
        return "No"


inp: str = str(input())
print(solution(inp))

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

Solution (Python):
import sys 
def get_string(): return sys.stdin.readline().strip() 
  
string = get_string()
s=0
while string!='':
    s=s+int(string[-1])
    string=string[:-1]
if s%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")


def solve():
    n = list(input().rstrip())
    print(["No", "Yes"][sum(map(int, n))%9==0])
    return



if __name__ == '__main__':
    solve()

Solution (Python):
a = input()

answer = 0

for i, val in enumerate(a):
	answer = (answer+int(val))%9

if answer == 0:
	print("Yes")
else:
	print("No")

Solution (Python):
N = input()
listN = list(N)
sumN = 0

for n in listN:
  newn =int(n)
  sumN += newn
  
if(sumN%9 == 0):
  print("Yes")
else:
  print("No")

Solution (Python):
n = input()
ans = 0
for i in n:
    ans += int(i)

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

Solution (Python):
numbers = input().split()
total = sum([int(number) for number in numbers])
if total%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())

while N >= 10:
  s = str(N)
  array = list(map(int, s))
  N = sum(array)

if N == 9 or N == 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")
elif n%9 != 0:
    print("No")

Solution (Python):
n = list(input())
N = [int(i) for i in n]
total = sum(N)
if total % 9 == 0:
  print("Yes")
else:
  print("No")

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

Solution (Python):
N = input()

count = 0
for n in N:
    count += int(n)

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

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

sum = 0
for i in N_str:
    sum = sum + int(i)


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

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

Solution (Python):
N = int(input())
n = str(N)
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())

s = str(n)
array = list(map(int, s))
if sum(array) % 9 == 0:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):



s = input()
sum = 0
for i in s:
    sum += int(i)
    sum = sum % 9

if sum == 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):



def solve(num):
    res = 0
    for x in num:
        dig = int(x)
        res = (res + dig) % 9

    if res == 0: return "Yes"
    return "No"


if __name__ == "__main__":
    num = input()
    print(solve(num))

Solution (Python):
def multiple_9(num):
    res = 0
    for s in num:
        res += int(s)
    return res % 9 == 0

def start():
    nums = input()
    if multiple_9(nums):
        print("Yes")
    else:
        print("No")
start()

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

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

Solution (Python):
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))

MOD = 10**9 + 7


def main():
	
	
	
	n = input().strip()
	i = 0
	s = 0
	while i < len(n):
		
		s += int(n[i])
		s %= 9
		i += 1
	print("YNeos"[s!=0::2])






if __name__ == "__main__":
	main()

Solution (Python):


from sys import stdin
from keyword import iskeyword

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

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

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

Solution (Python):
n = input()
result = 0
for N in n:
    result += int(N)



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

Solution (Python):
n = input()

s = sum([int(v) for v in n.split()])

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

Solution (Python):
N = input()

hantei = 0

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

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)

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

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

Solution (Python):
N = int(input())
total = list(str(N))
ntotal = 0
for i in range(len(total)):
  ntotal += int(total[i])

if ntotal % 9 == 0 or ntotal == 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()
array = list(map(int, N))

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

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):




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()
n_arr = [int(n[i]) for i in range(len(n))]
tmp = 0
for i in n_arr:
    tmp += i
if tmp % 9 == 0:
    ans = 'Yes'
else:
    ans ='No'
print(ans)

Solution (Python):
def probB():
    N = input()
    n = 0

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

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


def main():
    probB()


if __name__ == '__main__':
    main()

Solution (Python):
n = []
n = list(map(int, input().split()))
cnt = 0
for i in range(len(n)):
    cnt += n[i]

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

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