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)
    cnt %= 9

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

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

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

Solution (Python):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

if __name__ == "__main__":
    main()

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

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    n = input()
    tmp = 0
    for x in n:
        tmp += int(x)
    ans = "Yes" if tmp % 9 == 0 else "No"
    print(ans)

if __name__ == '__main__':
    solve()

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

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

Solution (Python):
def main():

    N = input()
    v = 0
    for c in N:
        v += int(c)
    if v % 9 == 0:
        return "Yes"
    return "No"

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

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

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

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  if N%9==0:
    return 'Yes'
  return 'No'


print(main())

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = list(str(input()))
N = map(int, N)

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

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

Solution (Python):


import os,sys
from io import BytesIO, IOBase

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


BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        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 = input()
ans = 0
for i in N:
    ans += int(i)

print('Yes' if not ans % 3 else 'No')

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    x = 0
    for s in S:
        x += int(s)
        x %= 9

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






if __name__ == '__main__':
    main()

Solution (Python):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	n = sys.stdin.readline().rstrip()
	cnt = 0
	for si in n:
		cnt += int(si)
	if cnt % 9 == 0:
		print("Yes")
	else:
		print("No")
	


main()

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

Solution (Python):
N = input()
res =0
for c in N:
    res += int(c)

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

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

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
def main():
    n = map(int, input().split())
    s9 = sum(n)
    if s9 % 9 == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
a = input()
sumer = 0
for i in a:
    sumer += int(i)

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = readline().strip()

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

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

    return


if __name__ == '__main__':
    main()

Solution (Python):
n = input()
ans = 0

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

if ans == 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 c in N:
    sum += int(c)
if sum % 9 == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

input = sys.stdin.readline


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

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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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

Solution (Python):

n = input()
print("YNeos"[sum(int(i) for i in n) % 9 > 0::2])

Solution (Python):
n = input()
ans = 0

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

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

cnt=0

for ss in s:
    ss = int(ss)
    cnt+=ss
    cnt%=9

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

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

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

S = sum(map(int, N))


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

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

Solution (Python):
import sys
import math
import collections
import bisect
import itertools



sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20

MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))




def main():
    n = list(input())

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

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


if __name__ == '__main__':
    main()

Solution (Python):
n = input()
s = 0
for t in n:
    s += int(t)
print("Yes" if s%9 == 0 else "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):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = input()
    cur = 0

    for x in n:
        cur += int(x)

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


if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys


buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N):
    ans = 0
    for c in N:
        ans += int(c)
    return 'Yes' if ans % 9 == 0 else 'No'


def main():
    N = read_str()
    print(slv(N))


if __name__ == '__main__':
    main()

Solution (Python):
N = input()

ans = 0

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

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

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

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n = input()
point = 0

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

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

Solution (Python):
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 19
MOD = 10 ** 19 + 7
EPS = 10 ** -10

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

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

Solution (Python):
import collections as cc
import sys
import bisect as bi
I=lambda:list(map(int,input().split()))
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())
print("Yes" if n%9==0 else "No")

Solution (Python):
import sys

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

    N = readline().rstrip()

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

solve()

Solution (Python):
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

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

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

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = input()
    k = 0
    for i in N:
        k += int(i)
        k %= 9

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

if __name__ == '__main__':
    main()

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

Solution (Python):
print ['No', 'Yes'][sum(map(int, list(raw_input()))) % 9 == 0]

Solution (Python):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
N = input().strip()
a = 0
for n in N:
    a += int(n)

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

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

Solution (Python):
n = input()  
val = 0
for ni in n:
    val += int(ni)

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

Solution (Python):
import sys




import math







stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    
    
    
    
    
    if n%9==0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    solve()

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

S = list(map(int, list(input().rstrip())))
print("Yes" if sum(S)%9 == 0 else "No")

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

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

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

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

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):
S = str(input())

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

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

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

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

Solution (Python):



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

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

Solution (Python):
n = input()

res = 0
for v in n:
    res += int(v)

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

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    s = input()

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

main()

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

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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




if __name__ == '__main__':
    main()

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

Solution (Python):

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

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


main()

Solution (Python):
def main():
    N = input()
    modsum = 0
    for c in N:
        modsum = (modsum + int(c)) % 9
    if modsum % 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):
n = list(input())
ans = 0
for i in n:
    ans += int(i)

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

Solution (Python):
import sys
from math import ceil
def input(): return sys.stdin.readline().strip()

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



if __name__ == "__main__":
    main()

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

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

Solution (Python):
N = input()

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

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

else:
    print("No")

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    N = input()
    S = list(str(N))

    sm = 0
    for s in S:
        n = int(s)
        sm += n

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

if __name__ == '__main__':
    solve()

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
S = input()

if sum(int(d) for d in S) % 9 == 0:
    print('Yes')
else:
    print('No')

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

for ch in num:
  s += ord(ch) - ord('0')

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
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 LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  

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

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

Solution (Python):
N = input()

v = 0
for i in N:
    v += int(i)
    v %= 9

if v:
    print("No")
else:
    print("Yes")

Solution (Python):
N = input()

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

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

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

Solution (Python):



import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        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")

def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

s = ri()
summ = 0
for i in s:
    summ+=int(i)
if summ%9 == 0:
    Yes()
else:
    No()

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

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

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

N = input()[:-1]
now = 0

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

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

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

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

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

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

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

Solution (Python):
n = str(input())
l = len(n)
s = 0
for i in range(l):
  s += int(n[i])
if s%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):
import sys
input = sys.stdin.readline
N = list(map(int, list(input())[: -1]))
res = 0
for x in N: res = (res + x) % 9
if res == 0: print("Yes")
else: print("No")

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

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

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

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

Solution (Python):

N = input()
res = 0
for v in N:
    res += int(v)

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

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

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

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

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

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

Solution (Python):

import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        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")


from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y
from math import ceil

for _ in range(int(input()) if not True else 1):
    
    s = input()
    if sum(int(k) for k in s) % 9 == 0:
        print("Yes")
    else:
        print("No")

Solution (Python):
N = input()
a = 0
for n in N:
    a += int(n)
    a %= 9

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

Solution (Python):
N=input()
mod=0
for c in N:
    mod+=int(c)%9

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

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