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):
def main():
     s = input()
     n = list(map(int, list(s)))
     if sum(n)%9 == 0:
         print('Yes')
     else:
         print('No')
         

if __name__ == '__main__':
    main()

Solution (Python):
S = input()

def check(S):
    if int(S) < 10:
        return int(S) % 9 == 0 
    else:
        return check(str(sum(map(int, S))))
print('Yes' if check(S) else 'No')

Solution (Python):




n = input()
nlen = len(n)


nsum = 0
for i in range(nlen):
    nsum = nsum + int(n[i])

if nsum % 9 == 0:
    ans = 'Yes'
else:
    ans = 'No'


print(ans)

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

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

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

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

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

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

Solution (Python):
n = input()

a = 0

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

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

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

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

Solution (Python):
n = input()

a = 0
for i in n:
    a += int(i)

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

Solution (Python):
ss=0
n=input().strip()
for i in range(len(n)):
	ss+=int(n[i])
	ss%=9 
if ss==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 digitSum(N)%9==0:
    print('Yes')
else:
    print('No')

Solution (Python):
def ok (s):
    if len(s) == 1:
        if s == '0' or s == '9':
            return 'Yes'
        else:
            return 'No'
    return ok(str(sum(map(int, s))))

print(ok(input()))

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

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

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

Solution (Python):



n = input()

r = 0

for s in n:
    r += int(s)
    r %= 9

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

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

Solution (Python):
N = input().strip()
d = sum([int(v) for v in N])

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

Solution (Python):
N = input()
ans = 0
while N:
    ans += int(N[-1])
    ans = ans % 9
    N = N[:-1]
if ans == 0:
    print('Yes')
else:
    print('No')

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

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

Solution (Python):
N = list(input())
sam = 0
for n in N:
  sam += int(n)
if sam%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):
sum=0
i=list(input())
for j in i:
    sum+=int(j)
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 = int(input())

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

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

Solution (Python):
n = input()

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

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

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

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

Solution (Python):

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

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

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





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

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

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]
"""
整数 Nが9の倍数であることと、Nを十進法で表したときの各桁の数の和が9の倍数であることは同値です。
Nが9の倍数であるか判定してください。
"""
N = int(input())
N = str(N)
v = 0
for n in N:
    v += int(n)
if v%9==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()

a= 0

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

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

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

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

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

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

if sum % 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_str = input()

sum_digits = 0
for N_digit in N_str:
    sum_digits += int(N_digit)
    sum_digits %= 9

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

Solution (Python):
a=str(input())
ans=0
for i in range(len(a)):
    ans+=int(a[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):




import sys
input = sys.stdin.readline



def main():
    N = input().rstrip()

    M = len(N)

    tot = 0

    for i in range(M):
        tot += int(N[i])
        tot %= 9

    if tot == 0:
        res = 'Yes'
    else:
        res = 'No'

    print(res)



main()

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

Solution (Python):
n = input()
sum = 0
for c in n:
    sum += int(c)
print('Yes') if sum % 9 == 0 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 = input()

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

Solution (Python):
S = [int(s) for s in input()]
ans = 'No'

if sum(S) % 9 == 0:
    ans = 'Yes'

print(ans)

Solution (Python):

s = input()

sum = 0
for sss in s:
    sum += int(sss)

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

Solution (Python):
N = input()

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

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

Solution (Python):
import numpy as np

N = str(input())
array = np.array(list(map(int, N)))

s = np.sum(array)
if s % 9 == 0:
  print('Yes')
else:
  print('No')

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

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

Solution (Python):
import math
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):
N = input()
keta_sum = sum([int(s) for s in N])

if keta_sum % 9==0:
    print('Yes')
    exit()
print('No')

Solution (Python):


sn = input()
ans = 0 



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

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

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

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

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

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

main()

Solution (Python):

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

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

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

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

Solution (Python):
N = input()

total = sum(int(x) for x in N)

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

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

total = 0
for n in str(N):
  total += int(n)
  
print("Yes" if total % 9 == 0 else "No")

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

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

def resolve():
    N = int(input())
    print("Yes" if N%9 == 0 else "No")
    
if __name__ == "__main__":
    resolve()

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


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

Solution (Python):
import sys
from math import ceil

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

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

if __name__ == '__main__':
    main()

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

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













from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
import numpy as np
import random
import bisect
import copy



MOD = int(1e9+7)
INF = float('inf')
alpha = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

def keta(kazu): 
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers): 
    return reduce(math.gcd, numbers)

def combination(m,n): 
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x

def fact(n): 
    arr = {}
    temp = n
    for i in range(2,int(n**0.5)+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
    if temp != 1:
        arr[temp] = 1
    if arr == {}:
        arr[n] = 1
    return arr
    
def main():
    a = int(stdin.readline().rstrip())
    if a % 9 == 0:
        print("Yes")
    else:
        print("No")
                
main()

Solution (Python):
import sys
import math


sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = input()

sum_n = 0
for c in N:
    sum_n += int(c)

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):
list = list(input())
L = len(list)
M = 0
for i in range(L):
    M += int(list[i])
if (M % 9) == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = input()
L = len(N)

SUM = 0
for i in range(L):
    SUM += int(N[i])

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

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())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N = input()

if (int(N)%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 = input()

ans =""
for s in n:
    ans += s + "+"
if eval(ans+"0") % 9== 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):
s = input()
a = [int(c) for c in s]


ans = 0
for num in a:
  ans += num
  if ans >= 9:
    ans -= 9

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

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

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

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

Solution (Python):
def resolve():
    N = input()

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

if __name__ == "__main__":
    resolve()

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

Solution (Python):
n = input()
l = len(n)
ref = 0

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

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

Solution (Python):
N = input()

list_num = list(N)

A = [int(s) for s in list_num]

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

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

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

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

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

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

c = str(c) 
for i in range(len(c)):
    d += int(c[i])

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

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

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

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

n = [int(i) for i in N]

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

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

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

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

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

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

ans = 0
for s in n:
    ans += int(s)
if ans % 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):
n = int(input())

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

Solution (Python):
num = int(input())
print(['Yes', 'No'][num%9>0])

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

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

Solution (Python):



import sys
from io import StringIO
import unittest


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_入力例_1(self):
        input = """123456789"""
        output = """Yes"""
        self.assertIO(input, 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)


def resolve():
    N = input()

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


if __name__ == "__main__":
    
    resolve()

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

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

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

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

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = list(map(int, input()))

    s = 0
    for num in n:
        s += num
        s %= 9

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


if __name__ == '__main__':
    resolve()

Solution (Python):

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

Solution (Python):
import sys

if sys.subversion[0] == "PyPy":
    import io, atexit

    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

    sys.stdin = io.BytesIO(sys.stdin.read())
    input = lambda: sys.stdin.readline().rstrip()
RS = raw_input
RA = lambda x=int: map(x, RS().split())
RN = lambda x=int: x(RS())


def solve():
    l = str(n)
    l = [int(i) for i in list(l)]
    s = sum(l)
    if s % 9 == 0:
        print("Yes")
    else:
        print("No")
    return




n = RN()
solve()

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=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 = list(map(int,input()))
m = sum(n)
if m%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):
n = str(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 os
import sys




def main():
    N = input()
    N_sum = 0
    for n in N:
        N_sum += int(n)
    if N_sum % 9 == 0:
        print('Yes')
    else:
        print("No")

if __name__ == "__main__":
    main()

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):
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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

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


n=int(input())

s=str(n)

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

if (cnt%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):
n = int(input())

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

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

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

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

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

ssum = 0
for i in N:
    ssum += int(i)

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

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

Solution (Python):
S = input()
cnt = 0
for i in S:
  cnt+=int(i)
  
if cnt % 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()
total = 0
for s in n:
    total += int(s)

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

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

Solution (Python):
def main():
	n = int(input())
	
	n_list = list(str(n))

	ans = 0

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

if __name__ == '__main__':
	main()

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

for p in range(len(N)):
    x += int(N[p])

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

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

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

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

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

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    print("Yes" if n % 9 == 0 else '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 = list(map(int, input().split()))
if sum(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 = int(input())
if n%9 == 0:
    print('Yes')
else:
    print('No')

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

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

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

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

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

Solution (Python):
n = input()

n_sum = 0
for ns in n:
    n_sum += int(ns)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10**6)

def main():
    N = list(input())
    intN = list(map(int, N))
    if sum(intN)%9 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
if a % 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()

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

q, mod = divmod(flag, 9)
if mod == 0:
  print("Yes")
else:
  print("No")

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


sys.setrecursionlimit(10**7)






N = str(input())
ans = "yes"
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()
if sum(list(map(int, list(n)))) % 9 == 0:
    print('Yes')
else:
    print('No')

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

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

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

for i in range(len(N)):
  S += int(N[i])
if S%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):
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

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

if __name__ == "__main__":
    main()

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

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

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

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

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

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

Solution (Python):

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

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

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

Solution (Python):
n=list(map(int, list(input())))
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=input()
c=[int(i) for i in n]
print("Yes" if sum(c)%9==0 else "No")

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

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


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

Solution (Python):
k = input()
ans = 0
for p in k:
    ans += int(p)

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

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

Solution (Python):
n = int(input())
n = str(n)
n = list(n)
ans = 0
for i in n:
    ans+=int(i)
if ans%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)

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

Solution (Python):
n_str = input()
total = 0

for n in n_str:
  total += int(n)

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

Solution (Python):
line=input()


c=0
for i in line:
    c+=int(i)

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

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

Solution (Python):
s = input()
l = len(s)
ans = 0

for i in range(l):
    ans += int(s[i])

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


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

main()

Solution (Python):


N = int(input())

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

Solution (Python):
N=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):
def main():
    N = str(input())
    A = 0
    for i in range(len(N)):
        A += int(N[i])
    
    if A % 9 == 0:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    main()

Solution (Python):
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


















def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


def solve():
    pass

def main():
    S = input().strip()
    N=len(S)
    temp=0
    for i in range(N):
        temp+=int(S[i])
        temp=temp%9
    if temp%9==0:
        ans="Yes"
    else:
        ans="No"
    print(ans)


if __name__ == '__main__':
    main()

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

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

if N % 9 == 0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

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

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