CodeEff/ECCO huggingface dataset:
# Original solution
N = int(eval(input()))

power = 1
for i in range(1,N+1) :
    power *= i

print((power % 1000000007))


# Optimized solution
N = int(eval(input()))

power = 1
for i in range(1,N+1) :
    power = i * (power % 1000000007)

print((power % 1000000007))
# Original solution
n = int(eval(input()))
pw = 1

for i in range(n):
    pw *= i+1
    
print((pw%(10**9+7)))

# Optimized solution
import math

n = int(eval(input()))

pw = math.factorial(n)
    
print((pw%(10**9+7)))
# Original solution
n = int(eval(input()))
ans = 1

for i in range(1,n+1):
    ans *= i

print((ans%(10**9+7)))


# Optimized solution
n = int(eval(input()))
ans = 1

for i in range(1,n+1):
    ans = i * ans % (10**9+7)

print(ans)
# Original solution
n=int(eval(input()))
ans=1
for i in range(1,n+1):
    ans*=i
  
print((ans%(10**9+7)))


# Optimized solution
n=int(eval(input()))
ans=1
for i in range(1,n+1):
    ans=(ans*i)%(10**9+7)
  
print((ans%(10**9+7)))
# Original solution
N=int(eval(input()))
X=0
for i in range(20000000):
    X=X+N%10
    N=N//10
    if N<1:
        break

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

# Optimized solution
N=int(eval(input()))
if N%9==0:
  print('Yes')
else:
  print('No')
# Original solution
n = int(eval(input()))

result = sum(list(map(int, str(n))))

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

# Optimized solution
n = int(eval(input()))

if n % 9 == 0:
  print('Yes')
else:
  print('No')
# Original solution
N = int(eval(input()))
if sum(int(i) for i in list(str(N))) % 9 == 0:
  print('Yes')
else:
  print('No')

# Optimized solution
N = str(eval(input()))
cnt = 0
for i in range(10):
  cnt += i * N.count(str(i))
  
print(('Yes' if cnt % 9 == 0 else 'No'))
# Original solution
n=int(eval(input()))
s=0
while n>0:
  r=n%10
  s=s+r
  n=n//10
if s%9==0:
  print('Yes')
else:
  print('No')

# Optimized solution
n=eval(input())
u=sum(map(int, str(n)))
if u%9==0:
  print('Yes')
else:
  print('No')
# Original solution
N = int(eval(input()))

sum = 0

while N:
  a = N%10
  sum += a
  N = N//10

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

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

N = int(eval(input()))

sum = digitSum(N)

if sum%9==0:
  print("Yes")
else:
  print("No")
# Original solution
import sys

n = int(eval(input()))
ans = 0
while n>0:
    ans += n%10
    n = n//10
    
#print(ans)

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




# Optimized solution
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

n = int(eval(input()))
ans = digitSum(n)
#print(ans)

if ans%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(read())
print(('Yes' if x % 9 == 0 else 'No'))


# Optimized solution
x = int(eval(input()))
print(('Yes' if x % 9 == 0 else 'No'))
# Original solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# 整数の入力
N = int(eval(input()))
s = 0

while N//10 != 0 or  N%10 !=0:
    s += N%10
    N //= 10

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

# Optimized solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# 整数の入力
N = int(eval(input()))
# s = 0

# while N//10 != 0 or  N%10 !=0:
#     s += N%10
#     N //= 10

if N % 9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))

print(('YNeos'[n%9>0::2]))

# Optimized solution
print(("YNeos"[int(eval(input()))%9>0::2]))
# Original solution
# Python profram to check if n is a multiple of 3 
  
# Function to check if n is a multiple of 3 
def isMultipleOf3(n): 
  
    odd_count = 0
    even_count = 0
  
    # Make no positive if + n is multiple of 3 
    # then is -n. We are doing this to avoid 
    # stack overflow in recursion 
    if(n < 0):  
        n = -n 
    if(n == 0): 
        return 1
    if(n == 1):  
        return 0
  
    while(n): 
          
        # If odd bit is set then 
        # increment odd counter  
        if(n & 1):  
            odd_count += 1
  
        # If even bit is set then 
        # increment even counter  
        if(n & 2): 
            even_count += 1
        n = n >> 2
  
    return isMultipleOf3(abs(odd_count - even_count))
num=int(eval(input()))
if (isMultipleOf3(num)):  
    print("Yes") 
else: 
    print("No") 


# Optimized solution
n=int(eval(input()))
if(n%9==0):
	print("Yes")
else:
	print("No")
# Original solution
def judge(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10
    return digits
def main(n):
    sum = 0
    for i in judge(n):
        sum += i
    if sum % 9 == 0:
      print("Yes")
    else:
      print("No")
if __name__=='__main__':
    N = int(eval(input()))
    main(N)

# Optimized solution
N = int(eval(input()))
if N % 9 == 0:
  print("Yes")
else:
  print("No")
# Original solution
n = int(eval(input()))
sum = 0
for i in range(len(str(n))):
    sum += (n % 10)
    n //= 10
if sum % 9 == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
n = int(eval(input()))
if n % 9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
n=int(eval(input()))
print(('YNeos'[(n%9!=0)::2]))


# Optimized solution
print(('YNeos'[int(eval(input()))%9!=0::2]))
# Original solution
N = int(eval(input()))

sum = 0

while N >= 1 :
    sum += N % 10
    N = N // 10
    if(sum > 100) :
      sum = sum % 9

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


# Optimized solution
N = int(eval(input()))

if N % 9 == 0 :
  print("Yes")
else :
  print("No")
# Original solution
def main():
    z = eval(input())
    x = int(z)

    sum = 0
    while x > 0:
        y = x % 10
        sum = sum + y
        x = x // 10

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

if __name__ == '__main__':
    main()


# Optimized solution
def main():
    z = eval(input())
    x = int(z)

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

if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
print(('No' if n % 9 else 'Yes'))


# Optimized solution
n=int(eval(input()))
print(('No' if n % 3 else 'Yes'))
# Original solution
#!/usr/bin/env python3

n = str(eval(input()))

ans = 0
count = 1
for i in reversed(n):
    ans += count*int(i)
    ans = ans % 9
    count *= 10
if ans == 0:
    print("Yes")
else:
    print("No")


# Optimized solution
#!/usr/bin/env python3

n = str(eval(input()))

ans = 0
count = 1
for i in reversed(n):
    ans += int(i)
    ans = ans % 9
    count *= 10
if ans == 0:
    print("Yes")
else:
    print("No")
# Original solution
import math

N = int(eval(input()))
if N == 0:
    N = 9
logN = math.log10(N)
keta = int(logN)
sum = 0
for i in range(keta,-1,-1):
    tem =int(N/10**i)
    sum += tem
    N = N - tem*10**i

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

# Optimized solution
N = int(eval(input()))
if N % 9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
import sys
cin = sys.stdin.readline
n = list(cin())
ans = 0

n.pop(-1)
for i in n:
    ans += int(i)
if ans % 9 == 0:
    print('Yes')
else:
    print("No")

# Optimized solution
import sys
cin = sys.stdin.readline
n = cin()
total = 0


for i in range(10):
    total += n.count(str(i)) * i
print(("Yes" if total%9 == 0 else "No"))
# Original solution
n = int(eval(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")

# Optimized solution
n=int(eval(input()))
print(("Yes" if n%9==0 else "No"))
# Original solution
i = int(eval(input()))
list = []
while i > 0:
    list.append(i%10)
    i //= 10
list.reverse()

SUM = sum(list)

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

# Optimized solution
n = int(eval(input()))

if n % 9 == 0:
    print('Yes')
else:
    print('No')
# Original solution
N=int(eval(input()))
A=[]
while N>0:
  A.append(N%10)
  N//=10
a=(sum(A))
if a%9==0:
  print('Yes')
else:
  print('No')

# Optimized solution
N=int(eval(input()))
L=[int(x) for x in list(str(N))]
a=sum(L)
if a%9==0:
  print('Yes')
else:
  print('No')
# Original solution
n = int(eval(input()))


def digits_of(n):
    digits = [] 
    while n != 0:
        r = n % 10 
        digits.append(r) 
        n = n // 10  
    return digits


def is_multiple_of_9(n): 
    sum = 0  
    for i in digits_of(n):
        sum += i
    return sum % 9 == 0


if is_multiple_of_9(n):
    print("Yes")
else:
    print("No")


# Optimized solution
n = int(eval(input()))


def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)


resu = digitSum(n) % 9
if resu == 0:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
sum=0
while N!=0:
    sum=(sum+N%10)%9
    N//=10
if sum%9==0:
    print("Yes")
else:
    print("No")


# Optimized solution
N=list(str(eval(input())))
sum=0
for i in range(len(N)):
    sum=(sum+int(N[i]))%9
if sum%9==0:
    print("Yes")
else:
    print("No")
# Original solution
def digits (n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r)
        n = n // 10 
    return digits

def check (n):
    sum = 0
    for i in digits (n):
        sum += i
    return sum % 9 == 0

n = int(eval(input()))
result = check(n)

if result == True:
    result = "Yes"
else:
    result = "No"
print(result)

# Optimized solution
n = int(eval(input()))
result = n % 9

if result == 0:
    result = "Yes"
else:
    result = "No"
print(result)
# Original solution
N = int(eval(input()))
s = 0

while N != 0:
    s = s + N % 10
    N = N // 10

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


# Optimized solution
N = int(eval(input()))
s = 0

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

if s % 9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
N = int(eval(input()))
sum = 0
while(N > 0):
    sum += N%10
    sum %= 9
    N //= 10
if(sum==0):
    print("Yes")
else:
    print("No")


# Optimized solution
N = int(eval(input()))
result = sum(list(map(int, str(N))))
if(result%9==0):
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))

sum = 0

while(n >= 1):
  sum += n % 10
  n //= 10

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

# Optimized solution
n = int(eval(input()))

# sum = 0

# while(n >= 1):
#   sum += n % 10
#   n //= 10

if(n % 9 == 0):
  print("Yes")
else:
  print("No")
# Original solution
n = int(eval(input()))
def digit_sum(n):
    # 各桁の和を求める
    # 計算量: O(logN)
    ans = 0
    while n > 0:
        ans += n % 10
        n //= 10
    return ans
if digit_sum(n)%9 ==0:
  print('Yes')
else:
  print('No')

# Optimized solution
n = int(eval(input()))
if n%9 ==0:
  print('Yes')
else:
  print('No')
# Original solution
n = int(eval(input()))
ans = 0
cnt = 0
while n>0:
    ans += n%10
    n //= 10
if ans%9 == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
n = str(eval(input()))
ans = 0
for i in range(len(n)):
    ans += int(n[i])
if ans%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
def findSumOfDigits(n):
    sum = 0
    while (n > 0):
        sum += n % 10
        n //= 10
    return sum

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

# Optimized solution
n = int(eval(input()))

if n % 9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def main():
    N = int(eval(input()))
    def calcSumOfDigit(x,acc=0):
        if x == 0:
            return acc
        else:
            return calcSumOfDigit(x//10,acc+x%10)
    def judge(x):
        return x % 9 == 0
    print(("Yes" if judge(calcSumOfDigit(N)) else "No"))
    return


if __name__ == '__main__':
    main()

# Optimized solution
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def main():
    N = int(eval(input()))
    def calcSumOfDigit(x):
        str_x = str(x)
        acc = 0
        for s in str_x:
            acc += int(s)
            acc %= 9
        return acc
    
    print(("Yes" if calcSumOfDigit(N)==0 else "No"))
    return


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))

a = 0
while N > 0:
  a += N % 10
  N //= 10

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


# Optimized solution
if int(eval(input())) % 9 == 0:
  print("Yes")
else:
  print("No")
# Original solution
n = int(eval(input()))

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


# Optimized solution
n = int(eval(input()))

print(("Yes" if n % 9 == 0 else "No"))
# Original solution

def digits_of(n):
    digits = []
    while n != 0:
        r = n % 10
        digits.append(r) 
        n = n // 10 
    return digits

def is_multiple_of_9 (n):
    sum = 0
    for i in digits_of (n):
        sum += i
    if sum % 9 == 0:
        print("Yes")
    else:
        print("No")

def main():
    n = int(eval(input()))
    is_multiple_of_9(n)

main()

# Optimized solution
def main():
    n = int(eval(input()))
    if n == 0:
        print("Yes")
    elif n % 9 == 0:
        print("Yes")
    else:
        print("No")

main()
# Original solution
print("YNeos"[int(eval(input()))%9!=0::2])

# Optimized solution
print("YNeos"[int(eval(input()))%9>0::2])
# Original solution
N = int(eval(input()))

sum_N = 0

while N >= 10:
  sum_N += N % 10
  N = N //10

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

# Optimized solution
N = int(eval(input()))

if N%9 ==0:
  print('Yes')
else:
  print('No')
# Original solution
n=int(eval(input()))

sum=0
for i in range(len(str(n))):
    sum+=int(list(str(n))[i])

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

# Optimized solution
n=int(eval(input()))

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

if sum%9==0:
    print('Yes')
else:
    print('No')
# Original solution
print("Yes") if int(input())%9 == 0 else print("No")


# Optimized solution
N = input()
ans = 0
for i in range(len(N)):
  ans += int(N[i])
print("Yes") if ans%9 == 0 else print("No")
# Original solution
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():
	# ans_ = []
	# ans_.append(ans)
	# print(("\n").join(map(str, ans_)))
	n = int(eval(input()))
	s = 0
	while n:
		s += n%10
		s %= 9
		n //= 10
	print(("YNeos"[s!=0::2]))






if __name__ == "__main__":
	main()

# Optimized solution
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():
	# ans_ = []
	# ans_.append(ans)
	# print(("\n").join(map(str, ans_)))
	n = input().strip()#10**200000 - 1#int(input())
	i = 0
	s = 0
	while i < len(n):
		# print(n)
		s += int(n[i])
		s %= 9
		i += 1
	print(("YNeos"[s!=0::2]))






if __name__ == "__main__":
	main()
# Original solution
'''
Problem Link - https://atcoder.jp/contests/abc176/tasks/abc176_b
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

def gcd(a,b):
	while b:
		a,b = b,a%b
	return a

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

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

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

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

def get_input(): return stdin.readline().strip()

def main():
	N = get_int()
	Sum = 0
	while N>0:
		rem = N%10
		Sum += rem*10
		N //= 10
	if Sum%9==0:stdout.write('Yes\n')
	else:stdout.write('No\n')

if __name__ == "__main__":
    main()

# Optimized solution
'''
Problem Link - https://atcoder.jp/contests/abc176/tasks/abc176_b
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

def gcd(a,b):
	while b:
		a,b = b,a%b
	return a

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

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

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

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

def get_input(): return stdin.readline().strip()

def main():
	N = get_input()
	Sum = 0
	for i in N:Sum+=int(i)
	if Sum%9==0:stdout.write('Yes\n')
	else:stdout.write('No\n')
	

if __name__ == "__main__":
    main()
# Original solution
n = int(eval(input()))

s = 0

for i in range(len(str(n))):
    s += n % 10
    n //= 10
    s %= 9

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


# Optimized solution
n = int(eval(input()))

print(('Yes' if n % 9 == 0 else 'No'))
# Original solution
import math
n = int(eval(input()))
list1 = []
if n == 0:
  	print("Yes")
else:
    for i in range(int(math.log10(n))+1):
        num = n%10
        n = n//10
        list1.append(num)
    if sum(list1)%9 == 0:
        print("Yes")
    else:
        print("No")

# Optimized solution
n = int(eval(input()))
a = sum(list(map(int, str(n))))
if a%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
N=int(eval(input()))

sum=0

while N>=1:
  sum+=N%10
  N=N//10
  sum=sum%9
  
if sum == 0:
  print('Yes')
else:
  print('No')

# Optimized solution
N=int(eval(input()))
if N%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
n = int(eval(input()))
s = 0
while n:
    d = n%10
    n = n//10
    s += d
if s%9 == 0:
    print("Yes")
else:
    print("No")
#a = list(map(int,input().split()))
#n,k,t = map(int,input().split())


# Optimized solution
n = int(eval(input()))
if n%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
n=int(eval(input()))

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


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

else:
    print("No")

# Optimized solution
n=int(eval(input()))


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

else:
    print("No")
# Original solution
#from functools import lru_cache
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=int(reader()[0][0])
a=[]
for i in range(200001):
    a.append(n%10)
    n//=10
print(('Yes' if sum(a)%9==0 else 'No'))

# Optimized solution
#from functools import lru_cache
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'))
# Original solution

n = int(eval(input()))

ans = 0

while n > 0:
    ans += n % 10
    n //= 10

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

# Optimized solution

n = int(eval(input()))

ans = 0

l = [int(x) for x in list(str(n))]
ans = sum(l)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')
# Original solution
n = int(eval(input()))

result = 0

while n != 0:
    q = n // 10
    mod = n % 10

    result += mod
    n = q

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


# Optimized solution
n = str(eval(input()))

count = 0
for v in list(n):
    count += int(v)

if (count % 9) == 0:
    print('Yes')
else:
    print('No')
# Original solution
N = str(eval(input()))

a = list(N)

result = 0

for x in a:
    x = int(x)
    result += x

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

# Optimized solution
N = str(eval(input()))

a = sum([int(n) for n in list(N)])

if a%9 == 0:
    print("Yes")
else:
    print("No")
# Original solution
N=int(eval(input()))
listN=[]
i=0
k=0
while N!=0:
  k+=N%10
  N=N//10
  
if k%9==0:
  print ('Yes')
else:
  print ('No')

# Optimized solution
N=int(eval(input()))
if N%9==0:
  print ('Yes')
else:
  print ('No')
# Original solution
import sys
readline = sys.stdin.buffer.readline

N = int(readline())

total = 0

while N >= 1:
    total += N % 10
    N //= 10
    total %= 9

ans = 'Yes' if total == 0 else 'No'

print(ans)

# Optimized solution
import sys
readline = sys.stdin.buffer.readline

N = int(readline())
ans = 'Yes' if N%9 == 0 else 'No'

print(ans)
# Original solution
n=int(eval(input()))
count_=0
while(n!=0):
    count_+=n%10
    n=n//10
    
if count_%9==0:
    print("Yes")
else:
    print("No")



# Optimized solution
n=int(eval(input()))
if n%9==0:
  print("Yes")
else:
  print("No")
# Original solution
N=int(eval(input()));tt=0
while(N):
    tt+=(N%10);N//=10
print(("No" if tt%9 else "Yes"))

# Optimized solution
print(("No"if int(eval(input()))%9 else "Yes"))
# Original solution
if int(eval(input())) % 9 == 0:
  print("Yes")
else:
  print("No")

# Optimized solution
if (int(eval(input())))%9 == 0:
  print("Yes")
else:
  print("No")
# Original solution
N = int(eval(input()))
S = 0
for i in range(2*10**5):
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')


# Optimized solution
N = int(eval(input()))
if N%9 ==0:
  print('Yes')
else:
  print('No')
# Original solution
a=int(eval(input()))
ans=0
while a//10!=0:
    ans+=a%10
    a=a//10
ans+=a
if ans%9==0:
    print("Yes")
else:
    print("No")

# Optimized solution
a=int(eval(input()))
if a%9==0:
    print("Yes")
else:
    print("No")
# Original solution
def dsum(n):
    wa = 0
    while n > 0:
        wa += n % 10
        n //= 10
    return wa


n = int(input())

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



# Optimized solution
n = int(input())
print("Yes") if n % 9 == 0 else print("No")
# Original solution
a=int(eval(input()))
sum=0
while(a>0):
  t=a%10
  sum=sum+t
  a=a//10
if(sum%9==0):
  print("Yes")
else:
  print("No")


# Optimized solution
a=eval(input())
sum=0
for digit in str(a):
    sum=sum+int(digit)
if(sum%9==0):
  print("Yes")
else:
  print("No")
# Original solution
# B

N = int(eval(input()))
solve = []

while N > 0:
    solve.append(N % 10)
    N //= 10

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

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

# Optimized solution
N = int(eval(input()))

k = N % 9

if k == 0:
    print('Yes')
    
if k != 0:
    print('No')
# Original solution
def main():
    N = int(eval(input()))
    sum = 0
    while True:
        amari = N % 10
        sum += amari
        N = N//10
        if N == 0:
            break

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

main()


# Optimized solution
def main():
    N = int(eval(input()))
    if (N%9) == 0:
        print('Yes')
    else:
        print('No')

main()
# Original solution
n = int(eval(input()))
cnt = 0
while n != 0:
    cnt += n % 10
    cnt %= 9
    n //= 10
if cnt == 0:
    print("Yes")
else:
    print("No")

# Optimized solution
n = int(eval(input()))
cnt = n % 9
if cnt == 0:
    print("Yes")
else:
    print("No")
# Original solution
print(("Yes"if int(eval(input()))%9==0else"No"))

# Optimized solution
a = int(eval(input()))

if a % 9:
    print("No")
else:
    print("Yes")
# Original solution
a = int(eval(input()))

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

# Optimized solution
print(("No"if int(eval(input()))%9else"Yes"))
# Original solution
n = int(eval(input()))
n_copy = n
digit_sum = 0

while(n_copy != 0):
    #print(digit_sum, n_copy%10, n_copy//10)
    digit_sum += n_copy%10
    n_copy //= 10

#print(digit_sum)

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

# Optimized solution
num = int(input())
print("Yes") if num%9 == 0 else print("No")