Harryxun/stf_run huggingface dataset:
H, W = map( int, input().split() )
S = [ list( input() ) for _ in range(H) ]

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
# (i, j) から行けるペアの数
def dfs( x, y, isVisited ):
    ans = 0
    isVisited[x][y] = True
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if S[x][y] == '#':
            if 0 <= nx and nx < H and 0 <= ny and ny < W and not isVisited[nx][ny]:
                if S[nx][ny] == '.': ans += dfs( nx, ny, isVisited )+1
        else:
            if 0 <= nx and nx < H and 0 <= ny and ny < W and not isVisited[nx][ny]:
                if S[nx][ny] == '#': ans += dfs( nx, ny, isVisited )
    return ans


ans = 0
for i in range(H):
    for j in range(W):
        isVisited = [ [False]*W for _ in range(H) ]
        if S[i][j] == '#': ans += dfs( i, j, isVisited )

print( ans )


### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(200000)

H, W = map( int, input().split() )
S = [ list( input() ) for _ in range(H) ]


isVisited = [ [False]*W for _ in range(H) ]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
# (i, j) から行けるペアの数
def dfs( x, y ):
    isVisited[x][y] = True
    numBlack, numWhite = 0, 0
    if S[x][y] == '#': numBlack = 1
    else:              numWhite = 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if 0 <= nx and nx < H and 0 <= ny and ny < W and not isVisited[nx][ny]:
            if S[x][y] != S[nx][ny]:
                tmpB, tmpW = dfs( nx, ny )
                numBlack += tmpB
                numWhite += tmpW
    return numBlack, numWhite

ans = 0
for i in range(H):
    for j in range(W):
        if not isVisited[i][j]: 
            numBlack, numWhite = dfs( i, j )
            ans += numBlack * numWhite

print( ans )
def dfs(cur, par, g, d):
    pars[cur] = par
    for to in g[cur]:
        if to == par:
            continue
        d[to] = d[cur]+1
        md[cur] = max(md[cur], dfs(to, cur, g, d)+1)
    return md[cur]


n, u, v = map(int, input().split())
u -= 1
v -= 1
g = []
for i in range(n):
    g.append([])
for i in range(n-1):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
d = []
md = []
pars = []
f = []
for i in range(n):
    d.append(-1)
    md.append(0)
    pars.append(-1)
    f.append(False)
d[u] = 0
dfs(u, -1, g, d)
cur = v
while cur != u:
    f[cur] = True
    cur = pars[cur]
pars[u] = True
res = d[v]//2
# for i in range(n):
#     if f[i] and d[i]*2 < d[v]:
#         for to in g[i]:
#             if to == pars[i] or f[to]:
#                 continue
#             res = max(res, md[to]+1+d[v]-d[i] - 1)
print(res)


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)


def dfs(cur, par, g, d):
    pars[cur] = par
    for to in g[cur]:
        if to == par:
            continue
        d[to] = d[cur]+1
        md[cur] = max(md[cur], dfs(to, cur, g, d)+1)
    return md[cur]


n, u, v = map(int, input().split())
u -= 1
v -= 1
g = []
for i in range(n):
    g.append([])
for i in range(n-1):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
d = []
md = []
pars = []
f = []
for i in range(n):
    d.append(-1)
    md.append(0)
    pars.append(-1)
    f.append(False)
d[u] = 0
dfs(u, -1, g, d)
cur = v
while cur != u:
    f[cur] = True
    cur = pars[cur]
f[u] = True
res = d[v]-1
for i in range(n):
    if f[i] and d[i]*2 < d[v]:
        for to in g[i]:
            if to == pars[i] or f[to]:
                continue
            res = max(res, md[to]+1+d[v]-d[i] - 1)
print(res)
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
sum_list = [(i+1)*100*pac[0] for i, pac in enumerate(pc)]
max_list = [(i+1)*100*pac[0]+pac[1] for i, pac in enumerate(pc)]
stoc = 0
shiyouzumi = []
ichian = 0
nian = 0
while 1:
    kouho1 = []
    kouho2 = []
    for i in range(D):
        if i in shiyouzumi:
            continue
        if G <= sum_list[i]:
            kouho1.append(i)
        if G <= max_list[i]:
            kouho2.append(i)
    if kouho1 != []:
        saikou = kouho1[-1]
        for i in range(pc[saikou][0]+1):
            if i*(saikou+1)*100 >= G :
                ichian = stoc+i
                break
    if kouho2 != []:
        mini = 1000
        for i in kouho2:
            if mini > pc[i][0]:
                mini = pc[i][0]
        nian = stoc+mini
    chiisai = min(ichian, nian)
    if chiisai != 0:
        print(chiisai)
        exit()
    kouritsu = 0
    kouritsu_i = -1
    for i, s in enumerate(max_list):
        if i in shiyouzumi:
            continue
        if s/pc[i][0] > kouritsu:
            kouritsu_i = i
            kouritsu = s/pc[i][0]
    stoc += pc[kouritsu_i][0]
    G -= max_list[kouritsu_i]
    shiyouzumi.append(kouritsu_i)

### FIXED CODE ###

R = int(input())
if R < 1200:
  print('ABC')
elif R < 2800:
  print('ARC')
else:
  print('AGC')
h,w,d = map(int, input().split())
a = []

PY = [list(map(int, input().split())) + [i] for i in range(h)]
for i in range(h):#h:高さ
    a.append([int(m) for m in input().split()])

q = int(input())
lr = []
for i in range(q):#h:高さ
    lr.append([int(m) for m in input().split()])

rea = []
for i in range(h * w):
    rea.append([])
for i in range(h):
    for j in range(w):
        rea[i].append([])


for i in range(h):
    for j in range(w):
        rea[w*i+j].append(a[i][j])
        rea[w*i+j].append(i)
        rea[w*i+j].append(j)

rea.sort()

pre = []
for i in range(h*w):
    pre.append([])

for i in range(h):
    for j in range(w):
        lmn = 0
        pre[w * i + j].append(lmn)
        for k in range(i, h*w,d):
            lmn += abs(rea[w*i+j + k][1] - rea[w*i+j+d + k][1]) + abs(rea[w*i+j + k][2]- rea[w*i+j+d + k][2])
            pre[w*i+j].append(lmn)

for i in range(q):
    print(pre[lr[i][0] - 1][(lr[i][1]-lr[i][0])//d - 1])

### FIXED CODE ###

h,w,d = map(int, input().split())
a = []

for i in range(h):#h:高さ
    a.append([int(m) for m in input().split()])

q = int(input())
lr = []
for i in range(q):#h:高さ
    lr.append([int(m) for m in input().split()])

rea = []
for i in range(h * w):
    rea.append([])


for i in range(h):
    for j in range(w):
        rea[w*i+j].append(a[i][j])
        rea[w*i+j].append(i)
        rea[w*i+j].append(j)

rea.sort()

pre = []
for i in range(h*w):
    pre.append([])
p = 0
for i in range(h):
    if p == 1:
        break
    for j in range(w):
        if w * i + j + 1 <= d:
            lmn = 0
            pre[w * i + j].append(lmn)

            for k in range(0,h*w,d):
                if w*i+j + d + k < h*w:
                    lmn += abs(rea[w*i+j + k][1] - rea[w*i+j+d + k][1]) + abs(rea[w*i+j + k][2]- rea[w*i+j+d + k][2])
                    pre[w*i+j].append(lmn)
                else:
                    break
        else:
            p = 1
            break

for i in range(q):
    print(pre[(lr[i][0] - 1) % d][(lr[i][1] - 1)//d] - pre[(lr[i][0] - 1) % d][(lr[i][0] - 1)//d])
n = int(input())

def func(n_):
    if n_ < 2:
        return 1
    else:
        return func(n_-2)*n_
c = 0
for i in list(str(func(n)))[::-1]:
    if i == "0":
        c += 1
    else:
        break
print(c)






### FIXED CODE ###

import copy

n = int(input())
def calc(N):
    n_ = (N - N%10)//10
    c = 1
    s = copy.deepcopy(n_)
    while n_//(5**c) >= 1:
        c +=1
    c -= 1
    for i in range(1,c+1):
        s += n_//5**i
    return s

if n%2 == 1 or n == 0:
    print(0)
else:
    print(calc(n))
def common_multiple(x, y):
    for i in range(2, min(x, y)+1):
        mod_x, mod_y = x % i, y % i
        if mod_x != 0 and mod_y != 0:
            next
        x0 = x // i if (mod_x == 0) else x
        y0 = y // i if (mod_y == 0) else y
        return common_multiple(x0, y0) * i
    return x * y


a = input().split(" ")
A, B, C, D = int(a[0]) - 1, int(a[1]), int(a[2]), int(a[3])

M = common_multiple(C, D)
B0 = B // C + B // D - B // M
A0 = A // C + A // D - A // M
print(B - A - B0 + A0)


### FIXED CODE ###

def common_multiple(x, y):
    for i in range(2, min(x, y)+1):
        mod_x = x % i
        mod_y = y % i
        if (mod_x == 0 and mod_y == 0):
            return common_multiple(x // i, y // i) * i
        if (mod_x == 0):
            return common_multiple(x // i, y) * i
        if (mod_y == 0):
            return common_multiple(x, y // i) * i
    return  x * y

a = input().split(" ")
A,B,C,D=int(a[0]) - 1,int(a[1]),int(a[2]),int(a[3])

M = common_multiple(C,D)
B0 = B // C + B // D - B // M
A0 = A // C + A // D - A // M
print(B - A - B0 + A0)
K, N = map(int,input().split())
N = N-1
A = list(map(int, input().split()))
A_d = [ A[i+1]-A[i] for i in range(0, len(A)-1)]
A_d.append(K-A[-1]+A[0])
print(A_d)
A_d2 = (A_d+A_d[1:])*2
print(A_d2)
res = K
for i in range(len(A_d2)-1):
    if res > sum(A_d2[i:i+N]):
        res = sum(A_d2[i:i+N])
print(res)

### FIXED CODE ###

s = input()
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')
N = int(input())
a = map(int, input().split())

mean = sum(a)/N

a = map(lambda x: abs(x-mean), a)

print(min(a).index)

### FIXED CODE ###

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

a = list(map(lambda x: int(abs(N*x-sum(a))), a))

print(a.index(min(a)))
N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
  if not i in d:
    d[i]=1
  else:
    d[i]+=1
c=0
e=list(sorted(d.items(),key=lambda x:x[1]))[:len(d.items())-K]
for i in e:
  c+=i[1]
print(c)


### FIXED CODE ###

N,K=map(int,raw_input().split())
d={}
l=map(int,raw_input().split())
for i in l:
  if not i in d:
    d[i]=1
  else:
    d[i]+=1
c=0
e=sorted(d.items(),key=lambda x:x[1])[:len(d.items())-K]
for i in e:
  c+=i[1]
print(c)
h=S/3600
k=S%3600
m=k/60
s=k%60
print("%d:%d:%d" %(h,m,s))

### FIXED CODE ###

S=int(input())
h=S/3600
k=S%3600
m=k/60
s=k%60
print("%d:%d:%d" %(h,m,s))
n = int(input())
s = input()

ans = 0
while s.find('#.') != -1:
    pos = s.find('#.')
    if pos-1 >= 0:
        if s[pos-1] == '#':
            s = s[:pos] + '##' + s[pos+2:]
    if pos+2 <= n-1:
        elif s[pos+2] == '.':
            s = s[:pos] + '..' + s[pos+2:]
    if pos-2 <= 0:
        elif s[pos-2:pos] == '#.':
            s = s[:pos] + '##' + s[pos+2:]
    if pos+4 <= n-1:
        elif s[pos+2:pos+4] == '#.':
            s = s[:pos] + '..' + s[pos+2:]
    else:
        s = s[:pos] + '##' + s[pos+2:]
    ans += 1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = list(input())
res = 10**9

cta = 0
ctb = 0
a = [0]*n
b = [0]*n
for i in range(n):
    if s[i] == '.':
        cta += 1
    else:
        ctb += 1
    a[i] = cta
    b[i] = ctb
for i in range(n):
    res = min(res,b[i]+a[-1]-a[i])
res = min(res,a[-1],b[-1])
print(res)
N, M, K = map(int,input().split())
class UnionFind:
    def __init__(self, N):
        self.par = [-1 for i in range(N+1)]
        self.rank = [1]*(N+1)
    
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if self.rank[x] > self.rank[y]:
            self.par[x] += self.par[y]
            self.par[y] = x
        else:
            self.par[y] += self.par[x]
            self.par[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

UF = UnionFind(N)
friendlist = [[] for _ in range(N+1)]
for n in range(M):
    A, B = map(int,input().split())
    friendlist[A].append(B)
    friendlist[B].append(A)
    if not UF.same_check(A,B):
        UF.union(A, B)
blocklist = [[] for _ in range(N+1)]
for n in range(K):
    C, D = map(int, input().split())
    blocklist[C].append(D)
    blocklist[D].append(C)

for person in range(1,N+1):
    root = UF.find(person)
    ans = -UF.par[root]-1
    ans -= len(friendlist[person])
    for l in blocklist[person]:
        if UF.same_check(person,l):
            ans -= 1
    print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5+10)
N, M, K = map(int,input().split())
class UnionFind:
    def __init__(self, N):
        self.par = [-1 for i in range(N+1)]
        self.rank = [1]*(N+1)
    
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if self.rank[x] > self.rank[y]:
            self.par[x] += self.par[y]
            self.par[y] = x
        else:
            self.par[y] += self.par[x]
            self.par[x] = y
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

UF = UnionFind(N)
friendlist = [[] for _ in range(N+1)]
for n in range(M):
    A, B = map(int,input().split())
    friendlist[A].append(B)
    friendlist[B].append(A)
    if not UF.same_check(A,B):
        UF.union(A, B)
blocklist = [[] for _ in range(N+1)]
for n in range(K):
    C, D = map(int, input().split())
    blocklist[C].append(D)
    blocklist[D].append(C)

for person in range(1,N+1):
    root = UF.find(person)
    ans = -UF.par[root]-1
    ans -= len(friendlist[person])
    for l in blocklist[person]:
        if UF.same_check(person,l):
            ans -= 1
    print(ans)
import sys
sys.setrecursionlimit(10000)

def connected(G,s,t):
    checked = [False]*len(G)
    def main(G,s,t):
        if t in G[s]: return True
        checked[s] = True
        for f in G[s]:
            if checked[f]: continue
            if main(G,f,t): return True
        return False
    return main(G,s,t)
        

if __name__=='__main__':
    n,m = list(map(int,input().split()))
    G = [[] for _ in range(n)]
    for _ in range(m):
        s,t = list(map(int,input().split()))
        G[s].append(t)
        G[t].append(s)
    q = int(input())
    for _ in range(q):
        s,t = list(map(int,input().split()))
        print('yes' if connected(G,s,t) else 'no')

### FIXED CODE ###

import sys
 
def make_connected_group(G):
    C = [None]*len(G)
    group = 0
    for i,p in enumerate(C):
        if p != None: continue
        friends = [i]
        while len(friends) > 0:
            f = friends.pop()
            if C[f] == None:
                C[f] = group
                friends += G[f]
        group += 1
    return C
 
 
if __name__=='__main__':
    n,m = list(map(int,sys.stdin.readline().split()))
    G = [[] for _ in range(n)]
    for j,line in enumerate(sys.stdin):
        if not j < m:
            q = int(line)
            break
        s,t = list(map(int,line.split()))
        G[s].append(t)
        G[t].append(s)
    C = make_connected_group(G)
    for j,line in enumerate(sys.stdin):
        if not j < q: break
        s,t = list(map(int,line.split()))
        print('yes' if C[s] == C[t] else 'no')
def lcm_base(x,y):
    return (x * y) // math.gcd(x,y)

def n_lcm(*numbers):
    print(reduce(lcm_base,numbers,1))
    
n_lcm(2,int(input()))

### FIXED CODE ###

import math

def lcm_base(x,y):
    return (x * y) // math.gcd(x,y)

print(lcm_base(2,int(input())))
import numpy as np
N = int(input())
total = []
dp = np.zeros((3,N), dtype = int)
for i in range(N):
  tmp = list(map(int,input().split()))
  if i == 0:
    dp[i][0] = tmp[0]
    dp[i][1] = tmp[1]
    dp[i][2] = tmp[2]
  else:
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + tmp[0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + tmp[1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + tmp[2]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))

### FIXED CODE ###

import numpy as np
N = int(input())
total = []
dp = np.zeros((N,3), dtype = int)
for i in range(N):
  tmp = list(map(int,input().split()))
  if i == 0:
    dp[i][0] = tmp[0]
    dp[i][1] = tmp[1]
    dp[i][2] = tmp[2]
  else:
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + tmp[0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + tmp[1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + tmp[2]
print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))
N, K = [int(a) for a in input().split()]

prob = 0

for i in range(1, N+1):
    j = i
    inverse_p = j
    while j < K:
        j *= 2
        inverse_p *= 2
    prob += 1/ p

print(prob)
    


### FIXED CODE ###

N, K = [int(a) for a in input().split()]

prob = 0

for i in range(1, N+1):
    j = i
    inverse_p = N
    while j < K:
        j *= 2
        inverse_p *= 2
    prob += 1/ inverse_p

print(prob)
import collections
import math

def C(n, r):
    if n-r < 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
#d = {}
d = [-1]*100000
sm = 0
for k,v in c.most_common():

    d[k] = v
    sm += C(v,2)

for a in A:
    print (sm - C(d[a],2) + C(d[a]-1,2) )


### FIXED CODE ###

import collections
import math

def C(n):
    if n-2 < 0:
        return 0
    return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
#d = {}
d = [-1]*200010
Cf = [C(i) for i in range(200010)]
sm = 0
for k,v in c.most_common():

    d[k] = v
    sm += C(v)

for a in A:
    print (sm - Cf[d[a]] + Cf[d[a]-1])
if int(input())>=3200: print(input()) else print('red')

### FIXED CODE ###

a = int(input())
s = input()
if a>=3200: print(s)
else: print('red')
# 各時点で最小

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

answer = 1
for _ in range(N):
  answer = min(answer*2, answer+K)

print(answer)

### FIXED CODE ###

# 各時点で最小

N,K = int(input()), int(input())

answer = 1
for _ in range(N):
  answer = min(answer*2, answer+K)

print(answer)
import numpy as np
data = input()
data = data.split(" ")
ans = 0
dataset = np.zeros(int(data[0]), dtype=np.int)
cont = int(data[1])
if int(data[1]) == 0:
    ans = 0

else:
    for i in range(int(data[0])):
        dataset[i] = 1
    print(cont, data)
    for i in range(int(data[0])):
        #print(i)
        if i == cont:
            print("px")
            dataset[cont:int(data[2]) + cont] = 2
            cont = i + int(data[2]) + int(data[1])

#print(dataset, data[1], int(np.count_nonzero(dataset == 1)))
print(int(np.count_nonzero(dataset == 1)))

### FIXED CODE ###

data = input()
if (data.count("A") == 3) or (data.count("B") == 3):
    ans = "No"
else:
    ans = "Yes"
print(ans)
# coding: utf-8
# Your code here!
import bisect

N,K=map(int,input().split())
X=list(map(int,input().split()))

zero=bisect.bisect_left(X,0)

ans=10**18
start=max(0,zero-K)
for i in range(start,start+N-K+1):
    if i==start:
        temp=X[i:i+K]
    else:
        temp.pop(0)
        temp.append(X[i+K-1])
    #print(temp)
    m=min(0,min(temp))
    M=max(0,max(temp))
    ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)
    
print(ans)



### FIXED CODE ###

# coding: utf-8
# Your code here!
import bisect

N,K=map(int,input().split())
X=list(map(int,input().split()))

zero=bisect.bisect_left(X,0)

ans=10**18
start=max(0,zero-K)
for i in range(start,start+N-K+1):
    #print(i)
    m=min(0,X[i])
    M=max(0,X[i+K-1])
    ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)
    if i+K==N:
        break
    
print(ans)
inp = [int(i) for i in input().split()]
n = inp[0]
a = inp[1]
b = inp[2]

# C = {}
# def cmb(n,r):
#   print(n,r)
#   if r==0 or r ==n:
#     return 1
#   if r==1:
#     return n
#   if (n,r) in C:
#     return C[(n,r)]
#   C[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
#   return C[(n,r)]

# def cmb(n, r):
#     if n - r < r: r = n - r
#     if r == 0: return 1
#     if r == 1: return n
#
#     numerator = [n - r + k + 1 for k in range(r)]
#     denominator = [k + 1 for k in range(r)]
#
#     for p in range(2,r+1):
#         pivot = denominator[p - 1]
#         if pivot > 1:
#             offset = (n - r) % p
#             for k in range(p-1,r,p):
#                 numerator[k - offset] /= pivot
#                 denominator[k] /= pivot
#
#     result = 1
#     for k in range(r):
#         if numerator[k] > 1:
#             result *= int(numerator[k])
#
#     return result

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 )

A = cmb(n,a,mod)
B = cmb(n,b,mod)
ans = 2**n-1-A-B
print(ans%(10**9+7))

### FIXED CODE ###

import math
n,a,b = [int(i) for i in input().split()]
mod = 10**9+7
  
def comb(n,k):
  ans = 1
  for i in range(k):
    ans = ans*(n-i)%mod
  for i in range(1,k+1):
    ans = ans*pow(i,mod-2,mod)%mod
  return ans

print((pow(2,n,mod)-1-comb(n,a)-comb(n,b))%mod)
# print(comb(n,a))
x = input()
a = int(x)
b = list(x)
b = sum(b)

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

### FIXED CODE ###

x = input()
a = int(x)
b = list(str(x))
b = list(map(int,b))
b = sum(b)

if a%b == 0:
  print('Yes')
else:
  print('No')
F = [1,1]

def fibo(n):
    if n <= len(F):
        return F[n-1]
    while len(F) < n:
        F.append(F[-1] + F[-2])
    return F[n-1]

N, M = list(map(int, input().split()))
A = [int(input()) for _ in range(M)]
MOD = 1000000007

B = [A[0]]
for i in range(M-1):
    B.append(A[i+1] - A[i] - 1)
B.append(N - A[M-1])
ans = 1
if 0 in B:
    ans = 0
else:
    for n in B:
        ans = ans * fibo(n) % MOD
print(ans)


### FIXED CODE ###

"""
F = [1,1]
def fibo(n):
    if n <= len(F):
        return F[n-1]
    while len(F) < n:
        F.append(F[-1] + F[-2])
    return F[n-1]
"""

N, M = list(map(int, input().split()))
A = [int(input()) for _ in range(M)]
MOD = 1000000007

if M == 0:
    B = []
    B.append(N+1)
elif M == 1:
    B = []
    B.append(A[0])
    B.append(N - A[0])

else:
    B = [A[0]]
    for i in range(M-1):
        B.append(A[i+1] - A[i] - 1)
    B.append(N - A[M-1])


ans = 1
if 0 in B:
    ans = 0
else:
    F = [1,1]
    for n in B:
        while len(F) < n:
            F.append(F[-1] + F[-2])
        now = F[n-1]
        ans = ans * now % MOD
print(ans)
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A, B, C, D = MAP()

print(min(A, B)+min(C, D))


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

A = INT()
B = INT()
C = INT()
D = INT()

print(min(A, B)+min(C, D))
a = [input() for i in range(3)]
# print(a)
# print(T[:-1])

# s_len = len(a[0])
# a[0] = a[0].rstrip('\n')


if a[0] == a[1][:-1]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a = [input() for i in range(2)]
# print(a)
# print(T[:-1])

# s_len = len(a[0])
# a[0] = a[0].rstrip('\n')


if a[0] == a[1][:-1]:
    print("Yes")
else:
    print("No")
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))


### FIXED CODE ###

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

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

a, b = [int(i) for i in input().split()]
print(lcm(a, b))