Harryxun/stf_run huggingface dataset:
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input().sprit()
    m, n = map(int, data.split())
    if m | n == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
a, b = map(int, input().split())
num_tap = 0
output = 0
if b == 1:
  print(0)
else:
  for i in range(30):
  output += 1
  if i == 0:
    num_tap += a
  else:
    num_tap += a-1
  if num_tap >= b:
    break
  print(output)

### FIXED CODE ###

a, b = map(int, input().split())
num_tap = 0
output = 0
if b == 1:
  print(0)
else:
  for i in range(30):
    output += 1
    if i == 0:
      num_tap += a
    else:
      num_tap += a-1
    if num_tap >= b:
      break
  print(output)
def pwd(N):
  return N^3

pwd(N)

### FIXED CODE ###

N=int(input())
print(N**3)
def main():
    import sys
    
    input = sys.stdin.readline

    K = int(input())
    res = 7

    if K % 2:
        while res < 10 ** 7:
            cal = func(K, res)
            k = str(cal)
            if k.count('7') == len(k):
                print(len(k))
                break
            res += 7
        else:
            print('-1')
    else:
        print('-1')


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
"""
数列777...は奇数故，Kが偶数だったら×

"""
from numba import njit


@njit(cache=True)
def func(a, b):
    return a * b


def main():
    import sys
    input = sys.stdin.readline

    K = int(input())

    # mod Kを考える(mod=module(剰余))
    x = 7 % K
    for i in range(1, K + 1):
        if x == 0:
            print(i)
            return
        x = (x * 10 + 7) % K
    print(-1)


if __name__ == '__main__':
    main()
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**6+2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

r1,c1,r2,c2=map(int,input().split())

print((cmb(r2+c2+2,c2+1,mod)+cmb(r1+c1,r1,mod)-cmb(r1+c2+1,c2+1,mod)-cmb(r2+c1+1,c1,mod))%mod)
N = int(input())
h = [int(x) for x in input().split()]
dp = [0]*N

for i in range(1,N):
  	if i==1:
      	dp[i] = abs(h[1]-h[0])
    elif i>1:
      	dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])
    
print(dp[N-1])

### FIXED CODE ###

N = int(input())
h = [int(x) for x in input().split()]
dp = [0]*N

for i in range(1,N):
    if i==1:
        dp[i] = abs(h[1]-h[0])
    elif i>1:
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2])

print(dp[N-1])
C:\acm\python\python.exe C:/acm/py/44.py
3
5 6 3 8
5 100 8
22
2
100 1 1
1 100
3
2
3 5 2
4 5
9


### FIXED CODE ###

while True:
    try:
        sum=0
        n=eval(input())
        l1=list(map(int,input().split()))
        l2=list(map(int,input().split()))
        for i in range(n):
            ss=1
            if(l2[i]-l1[i]>0):
                s=l2[i]-l1[i]
                if l1[i+1]-s<0:
                    sum+=l1[i+1]
                    l1[i+1]=0
                else:
                    l1[i+1]-=s
                    sum+=s
                    sum+=l1[i]
                    ss=0
                if(ss!=0):sum+=l1[i]

            elif(l2[i]-l1[i]<=0):
                sum+=l2[i]
        print(sum)
    except:break
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

# 左端点から右端点に行くパターン
# 右端点から左端点に行くパターン
# 求めるのはDの最大値
# 差のgcdとか？

N, X =  map(int, sys.stdin.readline().split())
L =  list(map(int, sys.stdin.readline().split()))
L = sorted(L.append(X))
D = [x2 - x1 for x1, x2 in zip(l , l[1::])]
print(reduce(gcd, D))

### FIXED CODE ###

import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N, X = map(int, sys.stdin.readline().split())
    L = list(map(int, sys.stdin.readline().split()))
    L.append(X)
    L.sort()
    D = [abs(x2 - x1) for x1, x2 in zip(L, L[1::])]
    print(reduce(gcd, D))
import operator
from functools import reduce
from scipy.misc import comb


def ncr(n, r):
    return comb(n, r, exact=True)


def step2patterns(num_step, step_dict):
    try:
        return step_dict[num_step]
    except KeyError:
        ret = step2patterns(num_step-1, step_dict) + step2patterns(num_step-2, step_dict)
        step_dict[num_step] = ret
        return ret


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1
d = {0: 1, 1: 1, 2: 2}

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= step2patterns(dry_step - 1, d)

    num_pattern %= 1000000007

# last step
dry_step = num_stair - last_wet

num_pattern *= step2patterns(dry_step - 1, d)

print(num_pattern % 1000000007)
exit(0)


### FIXED CODE ###

def exec_ncr(max_step, record_dict):
    for i in range(2, max_step+1):
        record_dict[i] = record_dict[i-1] + record_dict[i-2]


num_stair, num_wet = map(int, input().split(' '))

last_wet = -1
num_pattern = 1
d = {0: 1, 1: 1}
exec_ncr(num_stair, d)

for i in range(0, num_wet):
    wet = int(input())
    dry_step = wet - last_wet - 1
    last_wet = wet

    if dry_step <= 0:
        print('0')
        exit(0)

    elif dry_step == 1 or dry_step == 2:
        continue

    else:
        num_pattern *= d[dry_step-1]

# last step
dry_step = num_stair - last_wet

num_pattern *= d[dry_step-1]

print(num_pattern % 1000000007)
exit(0)
def resolve():
    a, b, h = list(map(int, input().split()))
    print((a + b) * h // 2)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    a = int(input())
    b = int(input())
    h = int(input())
    print((a + b) * h // 2)


if __name__ == "__main__":
    resolve()
import math

A = int(input())
B = int(input())
if a >= 2 and B>= 1:
    x = (B-1) / (A-1)

    print(math.ceil(x))


### FIXED CODE ###

import math
A, B = list(map(int, input().split()))
print(math.ceil((B-1)/(A-1)))
Copy
Copy
s = input()
k = s[::2]
g = s[1::2]
 
if (k in "R" or "U" or "D") and (g in "L" or "U" or "D"):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=input()
if "L" in s[::2] or "R" in s[1::2]:
  print("No")
else:
  print("Yes")
s = input()
while len(s) >= 4:
  s.replace("eraser", "")
  s.replace("erase", "")
  s.replace("dreamer", "")
  s.replace("dream", "")
  if len(s) == 0:
    print('YES')
    return
print('NO')

### FIXED CODE ###

s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")
N,Yen=map(int,input())

def solver(n,yen):
  for x in range(n+1):
    for y in range(n-x+1):
      z=n-x-y
      if x*10000+y*5000+z*1000 == yen:
        return x,y,z
  return -1,-1,-1
print(solver(N,Yen))

### FIXED CODE ###

N,Yen=map(int,input().split())

def solver(n,yen):
  for x in range(n+1):
    for y in range(n-x+1):
      z=n-x-y
      if x*10000+y*5000+z*1000 == yen:
        return x,y,z
  return -1,-1,-1
print(*solver(N,Yen))
s = input()
n = len(s)
count = 0

while True:
    if '10' in s:
        count += s.count('10') * 2
        s = s.replace('10','')
    elif '01' in s:
        count += s.count('01','') * 2
        s = s.replace('01','')
    else:
        break

print(count)


### FIXED CODE ###

s = input()
print(min(s.count('0'),s.count('1'))*2)
N = int(input())
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)
n=int(input())
x=list(map(int,input().split()))
l=[0 for i in range(10)]
d=0
for i in x:
  if i in range(400):
    l[0]+=1
  elif i in range(400,800):
    l[1]+=1
  elif i in range(800,1200):
    l[2]+=1
  elif i in range(1200,1600):
    l[3]+=1
  elif i in range(1600,2000):
    l[4]+=1
  elif i in range(2000,2400):
    l[5]+=1
  elif i in range(2400,2800):
    l[6]+=1
  elif i in range(2800,3200):
    l[7]+=1
  else:
    d+=1
p=[i for i in l if i>0]
print(min(p),max(p)+d)
   


### FIXED CODE ###

N=int(input())
List = list(map(int, input().split()))
sumList = [0]*8
mid = 0
for i in range(N):
  if 1<=List[i]<=399:
    sumList[0] += 1
  elif 400<= List[i] <=799:
    sumList[1] += 1
  elif 800 <= List[i] <= 1199:
    sumList[2] += 1
  elif 1200<= List[i] <=1599:
    sumList[3] += 1
  elif 1600<= List[i] <=1999:
    sumList[4] += 1
  elif 2000 <= List[i] <= 2399:
    sumList[5] += 1
  elif 2400 <= List[i] <= 2799:
    sumList[6] += 1
  elif 2800 <= List[i] <= 3199:
    sumList[7] += 1
  elif 3200 <= List[i]:
    mid += 1
res1 = 8 - sumList.count(0)
res2 = res1 + mid
if res1 == 0 and mid > 0:
  res1 = 1
print(res1,res2)
N = int(input())
nums = [int(s) for s in input().rstrip().split()]
Q = int(input())

dct = {}
for k in range(N):
  n = nums[k]
  if n in dct:
    dct[n] += 1
  else:
    dct[n] = 1

for _ in range(Q):
  B, C =(int(s) for s in input().rstrip().split())
  if C in dct:
    dct[C] += dct.pop(B)
  else:
    dct[C] = dct.pop(B)

  sum = 0
  for k, v in dct.items():
    sum += k * v
  
  print(sum)

### FIXED CODE ###

from collections import defaultdict

N = int(input())
nums = list(map(int,input().split()))
Q = int(input())

res = 0

dct = defaultdict(int)
for _ in range(N):
  n = nums.pop()
  dct[n] += 1
  res += n

for _ in range(Q):
  B, C = map(int,input().split())
  if B in dct:
    n = dct.pop(B)
    res += (C - B) * n
    if C in dct:
      dct[C] += n
    else:
      dct[C] = n
  
  print(res)
N = map(int,input().split())
if N % 3 ==0:
	print("Yes")
else:
  	print("No")

### FIXED CODE ###

s = input()
if "7" in s:
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int, input().split(' ')))


a = sorted(a, reverse=True)
count = 0
edge = []
i = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        count = count + 1
        edge.append(a[i])
        i = i + 1
        if count == 2:
            break

s = edge[0]*edge[1] if count == 2 else 0
print(s)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

count = 0
edge = []

i = 0
for _ in range(n-1):
    if a[i] == a[i+1]:
        count = count + 1
        edge.append(a[i])
        i = i + 1
        if count == 2:
            break
    i = i + 1

s = edge[0]*edge[1] if count == 2 else 0
print(s)
A, B, C, D = input().split()
A = int(A)
B = int(B)
C = int(C)
D = int(D)


def solve(A, B, C, D):
    if A < C:
        if B < C:
            print("0")
        elif A <= C and D <= B:
            print(str(D-C))
        else:
            ptint(str(B-C))
    else:
        if D < A:
            print("0")
        elif C <= A and B <= D:
            print(str(B-A))
        else:
            print(str(D-A))

solve(A, B, C, D)


### FIXED CODE ###

A, B, C, D = input().split()
A = int(A)
B = int(B)
C = int(C)
D = int(D)


def solve(A, B, C, D):
    if A < C:
        if B < C:
            return 0
        elif A <= C and D <= B:
            return (D - C)
        else:
            return (B - C)
    else:
        if D < A:
            return 0
        elif C <= A and B <= D:
            return (B - A)
        else:
            return (D - A)

print(solve(A, B, C, D))
print(int(a+a**2+a**3))

### FIXED CODE ###

a=int(input())
print(a+a**2+a**3)
import numpy as np
N=int(input())
def gcd(N,2):
  c=int(np.floor(N%2))
  return N-2*c
if gcd(N,2)==0:
  print(N)
else:
  print(2*N)

### FIXED CODE ###

import numpy as np
N=int(input())
def gcd(a,b):
    c=int(np.floor(a/b))
    return a-b*c
if gcd(N,2)==0:
    print(N)
else:
    print(2*N)
a,b,c=map(int,input().split())
if a>=c:
  print(a-c,b)
else if a+b>=c:
  print(0,a+b-c)
else:
  print(0,0)

### FIXED CODE ###

a,b,c=map(int,input().split())
aa=max(0,a-c)
print(aa,max(0,a+b-aa-c))
n, k = map(int, input().split())
a = [int(i) for i in input().split()]


lst = []
visit_now = 1
visit_list = [0] * n

while True:
    if visit_list[visit_now - 1] == 1:
        break
    visit_list[visit_now - 1] = 1
    lst.append(visit_now)
    visit_now = a[visit_now - 1]


start = lst.index(visit_now)
loop_num = n - start - 1
# lst = lst[start:]

if k <= start:
    ans = lst[k]
else:
    k -= start
    k %= loop_num
    ans = lst[start + k]

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i) for i in input().split()]


lst = []
visit_now = 1
visit_list = [-1] * (n + 1)
cnt = 0

while visit_list[visit_now - 1] == -1:
    visit_list[visit_now - 1] = cnt
    lst.append(visit_now)
    visit_now = a[visit_now - 1]
    cnt += 1

start = visit_list[visit_now - 1]
loop_num = cnt - start

if k <= start:
    ans = lst[k]
else:
    k -= start
    k %= loop_num
    ans = lst[start + k]

print(ans)
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():
    h, w, m = MAP()
    s = [LIST1() for i in range(m)]
    ay = [0]*h
    ax = [0]*w
    c = [[0]*w for i in range(h)]
    for x in s:
        ay[x[0]] += 1
        ax[x[1]] += 1
        c[x[0]][x[1]] = 1

    my = max(ay)
    mx = max(ax)
    by = [i for i, x in enumerate(ay) if x == my]
    bx = [i for i, x in enumerate(ax) if x == mx]

    ans = my + mx
    tmp = 1
    if len(by)*len(bx) > m:
        tmp = 0
    else:
        for y in by:
            for x in bx:
                if c[y][x] == 0:
                    tmp = 0
                    break
            else:
                continue
            break
    print(ans - tmp)

if __name__ == '__main__':
    solve()


### FIXED CODE ###

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():
    h, w, m = MAP()
    s = [LIST1() for i in range(m)]
    ay = [0]*h
    ax = [0]*w
    for x in s:
        ay[x[0]] += 1
        ax[x[1]] += 1

    my = max(ay)
    mx = max(ax)
    
    by = bx = 0
    for y in ay:
        if y == my:
            by += 1
    for x in ax:
        if x == mx:
            bx += 1
            
    ans = my + mx
    tmp = 0
    for x in s:
        if ay[x[0]]+ax[x[1]]==ans:
            tmp += 1
    if tmp == by*bx:
        ans -= 1
    print(ans)
    
if __name__ == '__main__':
    solve()
import numpy as np
N=input()
a=list(map(int,input().split(",")))
a=np.asarray(a)
b=0
while True:
  if all(a%2==0):
    a=a/2
    b+=1
  else:
    break
print(b)


### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
print(.swapcase())

### FIXED CODE ###

s = input()
print(s.swapcase())
n,m = map(int, input().split())
a = sorted(list(map(int,input().split())))
print(a[-1]+a[-2]+a[-3])

### FIXED CODE ###

n,k= map(int, input().split())
l = sorted(list(map(int, input().split())))
a = 0
for i in range(k):
    a += l[-(i+1)]
print(a)
n = input()

sum(list(map(int, str(n))))
a = sum // 9

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

else:
  print("No")


### FIXED CODE ###

N = input()
s = len(N)
sum = 0

for i in range(s):
  sum += int(N[i])
  
if sum % 9 == 0:
  print("Yes")
  
else:
  print("No")
import sys
from collections import defaultdict
r=sys.stdin.readline
X,Y=map(int,r().split())
#a=X-2b, b=Y-2a
sys.setrecursionlimit(10**6)
if (X+Y)%3!=0:
    print(0)
    exit(0)   
a=(2*Y-X)//3
b=(2*X-Y)//3
MOD=10**9+7
N=10**6
#permutation with repetition
#ex) ab, ba --> a+bCa
def pow(a,b):
    ans=1
    while b:
        if b&1:
            ans=(ans*a)%MOD
        a=(a**2)%MOD
        b=b//2
    return ans 
N=a+b
K=a
fac=[1 for _ in range(N+1)]
for i in range(2,N+1):
    fac[i]=(fac[i-1]*i)%MOD
A=fac[N]
B=(fac[N-K]*fac[K])%MOD
print((A%MOD)*pow(B,MOD-2)%MOD)



### FIXED CODE ###

import sys
r=sys.stdin.readline
X,Y=map(int,r().split())
#a=X-2b, b=Y-2a
if 2*X-Y<0 or (2*X-Y)%3!=0 or 2*Y-X<0 or (2*Y-X)%3!=0:
    print(0)
    exit(0)   
a=(2*Y-X)//3
b=(2*X-Y)//3
MOD=10**9+7
#ex) ab, ba --> a+bCa
def pow(a,b):
    ans=1
    while b:
        if b&1:
            ans=(ans*a)%MOD
        a=(a**2)%MOD
        b=b//2
    return ans 
N=a+b
K=a
fac=[1 for _ in range(N+1)]
for i in range(2,N+1):
    fac[i]=(fac[i-1]*i)%MOD
A=fac[N]
B=(fac[N-K]*fac[K])%MOD
print((A%MOD)*pow(B,MOD-2)%MOD)
def dfs(u, cnt):
    cnt += point[u]
    counter[u] = cnt
    color[u] = GRAY
    for v in M[u]:
        if color[v] == WHITE:
            dfs(v, cnt)
    color[u] = BLACK


n, q = map(int, input().split())
M = [[] for _ in range(n)]
point = [0] * n
for i in range(n-1):
    a, b = map(int, input().split())
    M[a-1].append(b-1)
for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x
#print(M, point)
    
WHITE, GRAY, BLACK = 0, 1, 2
color = [WHITE] * n

counter = [0] * n
dfs(0, 0)

print(*counter)


### FIXED CODE ###

def dfs(u, cnt):
    cnt += point[u]
    counter[u] = cnt
    color[u] = GRAY
    for v in M[u]:
        if color[v] == WHITE:
            dfs(v, cnt)
    color[u] = BLACK

import sys
sys.setrecursionlimit(1000000)

n, q = map(int, input().split())
M = [[] for _ in range(n)]
point = [0] * n
for i in range(n-1):
    a, b = map(int, input().split())
    M[a-1].append(b-1)
    M[b-1].append(a-1)
for i in range(q):
    p, x = map(int, input().split())
    point[p-1] += x
#print(M, point)
    
WHITE, GRAY, BLACK = 0, 1, 2
color = [WHITE] * n

counter = [0] * n
dfs(0, 0)

print(*counter)
import math

A, B = map(int, input().split())
print((A * B) // math.gcd(A, B))

### FIXED CODE ###

import fractions

A, B = map(int, input().split())
print((A * B) // fractions.gcd(A, B))
l=raw_input().split()
print l[0][0].upper()+l[1][0].upper()+l[2][0].upper()

### FIXED CODE ###

l=raw_input().split()
print l[0][0].upper()+l[1][0].upper()+l[2][0].upper()