Harryxun/stf_run huggingface dataset:
N=int(input())
s=[input() for i in range(N)]
count=0
if(len(s)!=len(set(s))):
  count=1
else:
  for i in range(N-1):
    len_s=len(s[i])
    if(s[i][len_s-1]!=s[i+1][0]):
      count=1
      break
    else:continue
if(count==0):
	print('Yes')
else:print('No')

### FIXED CODE ###

a,b=map(int,input().split())
print('No' if (a*b%2==0) else 'Yes')
N=input()
 print(N^3)

### FIXED CODE ###

n=int(input())
print(n**3)
n=int(input())
*a=map(int,input().split())
g=[[0] for i in range(n)]*60
mod=10**9+7
for i in range(n):
    for j in range(60):
        if (a[i]>>j)&1:
            g[j][i]=1

cnt=0
for i in range(60):
    now=g[i].count(1)
    cnt+=now*(n-now)*(2**i)
    cnt%=mod

print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
g=[0]*60
mod=10**9+7
for i in range(n):
    for j in range(60):
        if (a[i]>>j)&1==1:
            g[j]+=1

cnt=0
for i in range(60):
    now=g[i]
    cnt+=now*(n-now)*(2**i)
    cnt%=mod

print(cnt)
k,a,b = map(int,input().split())
biscuits = 1

#交換しても割に合わない
if a > b:
        biscuits = k+1

#交換するとお得

#交換できない(叩き続ける)
if a < b:
    if k - 1 < a:
        biscuits = k + 1

#交換可能(集まり次第交換)
    if k - 1 >= a:
        if (k - a - 1) % 2 == 0:
            p = k - a - 1
            biscuits = (p / 2 + 1) * b - p / 2 * a
        else:
            biscuits = (p / 2 + 1) * b + 1

        
print(biscuits)    

### FIXED CODE ###

k,a,b = map(int,input().split())
biscuits = 1

if b - a <= 1:
        biscuits = k+1
else:
    p = k - a + 1
    biscuits = a + (b - a) * (p // 2)
    biscuits = biscuits + (k - a + 1) % 2

print(biscuits)
c =input()
c=c.upper()
c=chr(ord(c) + 1)
print(x)
 

### FIXED CODE ###

x = input()
print(chr(ord(x) + 1))
a,b,c,d=map(int,input().split())
if a%d>0:
   a=a//d+1
elif a%d==0:
   a=a//d
if c%b>0:
   c=c//b+1
elif c%b==0
if a>=c:
   print("yes")
else:
   print("no")

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a%d>0:
   a=a//d+1
elif a%d==0:
   a=a//d
if c%b>0:
  c=c//b+1
elif c%b==0:
  c=c//b
if a>=c:
  print("Yes")
else:
  print("No")
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *                # alpha = ascii_lowercase
from random import *                # l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *                # d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter        # d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	for i,j in q:
		for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
			if(0 <= r < H and 0 <= c < H and grid[r][c] == '.'):
				grid[r][c] = grid[i][j] + 1
				maxx = max(maxx,grid[r][c])
				q.append([r,c])
	return maxx

H,W = map(int, stdin.readline().rstrip().split())
grid = []
for h in range(H):
	s = list(input())
	grid.append(s)
ans = solve(grid)
print(ans)


### FIXED CODE ###

# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	while(q):
		qq = []
		for i,j in q:
			for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
				if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
					grid[r][c] = grid[i][j] + 1
					maxx = max(maxx,grid[r][c])
					qq.append([r,c])
		q = qq
	return maxx

H,W = map(int, raw_input().split())
grid = []
for h in range(H):
	s = list(raw_input())
	grid.append(s)
ans = solve(grid)
print(ans)
N, M, K = map(int, input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]

#print(friend)
#print(block)
graph = [[] for _ in range(N)]
bgraph = [[] for _ in range(N)]
cnt = []
for i in range(M):
    ii, jj = friend[i]
    graph[ii-1].append(jj-1)
    graph[jj-1].append(ii-1)

for i in range(K):
    ii, jj = block[i]
    bgraph[ii-1].append(jj-1)
    bgraph[jj-1].append(ii-1)

#print(graph)
#print(bgraph)

seen = [False for _ in range(N)]

def dfs(i,j):
    if i not in bgraph[j]:
        seen[i]= True
    else:
        seen[i]="block"
    if graph[i]:
        for nec in graph[i]:
            if seen[nec] == False:
                dfs(nec,j)


for i_n in range(N):
    seen = [False for _ in range(N)]
    dfs(i_n,i_n)
    cnt.append(seen.count(True) - 1 - len(graph[i_n]))

print(*cnt)


### FIXED CODE ###

#計算時間が足りない　何がダメなのか　工夫が足りない　研究が必要
from collections import deque


N, M, K = map(int, input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]
#sys.setrecursionlimit(2*N)
#print(friend)
#print(block)
graph = [[] for _ in range(N)]
bgraph = [[] for _ in range(N)]
cnt = [0]*N
for i in range(M):
    ii, jj = friend[i]
    graph[ii-1].append(jj-1)
    graph[jj-1].append(ii-1)

for i in range(K):
    ii, jj = block[i]
    bgraph[ii-1].append(jj-1)
    bgraph[jj-1].append(ii-1)

#print(graph)
#print(bgraph)

seen = [False for _ in range(N)]
seenb = [False for _ in range(N)]
def dfs():
    labelb = 1
    #while False in seen:
    for i in range(N):
        if seen[i] != False: continue
        label = 1
        #i = seen.index(False)
        seen[i] = label
        seenb[i] = labelb
        que = deque([i])
        seg = deque([i])
        while que:
            #print(que)
            neci = que.pop()
            for nec in graph[neci]:
                if seen[nec]== False:
                    seen[nec]=label
                    seenb[nec]=labelb
                    que.append(nec)
                    seg.append(nec)
                    label += 1
        for iii in seg:
            seen[iii] = label

        labelb += 1

dfs()
for i in range(N):
    count = seen[i] - 1 -len(graph[i])
    if bgraph[i] and seen[i]>=2:
          for j in bgraph[i]:
                if seenb[i] == seenb[j]:
                    count -= 1
    cnt[i]=count
print(*cnt)
N = int(input())
l = [int(input()) for i in range(N)]
index = 0
count = 0
for j in range(N):
    index = l[index]
    count += 1
    if index == 2:
        print(count)
        exit()
print(-1)

### FIXED CODE ###

N = int(input())
l = [int(input()) for i in range(N)]
index = 0
count = 0
for j in range(N):
    index = l[index] - 1
    count += 1
    if index == 1:
        print(count)
        exit()
print(-1)
abc = input().split()
if(int(abc[0])< int(abc[1]) and int(abc[1] < int(abc[2])) ):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

abc = input().split()
if(int(abc[0]) < int(abc[1]) and int(abc[1]) < int(abc[2])):
    print('Yes')
else:
    print('No')
N,A,B = map(int,input().split())
a = ""
b = ""
for i in range(A):
  a += "a"
for j in range(B):
  b += "b"
c = a+b
while len(c) <= N:
  c += c

d = c[:N]
print(d.count("a"))

### FIXED CODE ###

import math
N,A,B = map(int,input().split())
c = N%(A+B)
p = math.floor(N/(A+B))
if c >= A:
  print((A*p)+A)
else:
  print((A*p)+c)
import sys
readline = sys.stdin.readline
N, K = map(int, input().split())
W = tuple(int(readline()) for _ in range(n))
ma = max(W)
def check(x):
    if x < ma:
        return False
    use = 1
    rest = x
    for w in W:
        if rest >= w:
            rest -= w
        else:
            rest = x - w
            use += 1
    return use <= K
l = 0
r = sum(W)
while r - l > 1:
    m = (r + l) // 2
    if check(m):
        r = m
    else:
        l = m
print(r)


### FIXED CODE ###

import sys
readline = sys.stdin.readline
N, K = map(int, input().split())
W = tuple(map(int, sys.stdin.readlines()))
ma = max(W)
def check(x):
    if x < ma:
        return False
    use = 1
    rest = x
    for w in W:
        if rest >= w:
            rest -= w
        else:
            rest = x - w
            use += 1
            if use > K:
                return False
    return True
l = 0
r = sum(W)
while r - l > 1:
    m = (r + l) // 2
    if check(m):
        r = m
    else:
        l = m
print(r)
n=int(input())
a=list(map(int,input().split()))

l=[]
l.append(a[0])
r=[]
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
  
for i in range(1,n-1):
  l.append(gcd(l[i-1],b[i]))
  r.append(gcd(r[i-1],b[n-1-i]))
  
for j in range(0,n):
  g.append(gcd(l[i],r[n-2-i]))
  
print(max(g))    
  
  


### FIXED CODE ###

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

l=[]
l.append(0)
l.append(0)
r=[]
r.append(a[n-1])
r.append(a[n-1])
g=[]

def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)


for i in range(1,n):
  l.append(gcd(l[i],a[i-1]))
  r.append(gcd(r[i],a[n-1-i]))
  
r[0]=l[n]

for j in range(0,n):
  g.append(gcd(l[j+1],r[n-j-1]))

print(max(g))
from collections import deque

n = int(input())
x = input()

memo = {0: 0}

def solve(X):
    x = X
    stack = deque([])
    while x:
        if x in memo:
            break
        stack.append(x)
        x = x % bin(x).count("1")
    cnt = memo[x] + 1
    while stack:
        x = stack.pop()
        memo[x] = cnt
        cnt += 1
    return cnt - 1



ans = []
px = x.count("1")

memo1 = [1 % (px - 1)] if px > 1 else []
memo2 = [1 % (px + 1)]
x1 = 0
x2 = 0

for i in range(n):
    if px > 1:
        memo1.append(memo1[-1] * 2 % (px-1))
    memo2.append(memo2[-1] * 2 % (px+1))

for i in range(n):
    if x[-i-1] == '1':
        x1 += memo1[i]
        x1 %= (px-1)
        x2 += memo2[i]
        x1 %= (px+1)

for i in range(n):
    if x[-i-1] == "1":
        if px > 1:
            ans.append(solve((x1-memo1[i])%(px-1)) + 1)
        else:
            ans.append(0)
    else:
        ans.append(solve((x2+memo2[i])%(px+1)) + 1)


for ansi in reversed(ans):
    print(ansi)


    

        


### FIXED CODE ###

from collections import deque

n = int(input())
x = input()

memo = {0: 0}

def solve(X):
    x = X
    stack = deque([])
    while x:
        if x in memo:
            break
        stack.append(x)
        x = x % bin(x).count("1")
    cnt = memo[x] + 1
    while stack:
        x = stack.pop()
        memo[x] = cnt
        cnt += 1
    return cnt - 1



ans = []
px = x.count("1")

memo1 = [1 % (px - 1)] if px > 1 else []
memo2 = [1 % (px + 1)]
x1 = 0
x2 = 0

for i in range(n):
    if px > 1:
        memo1.append(memo1[-1] * 2 % (px-1))
    memo2.append(memo2[-1] * 2 % (px+1))

for i in range(n):
    if x[-i-1] == '1':
        if px > 1:
            x1 += memo1[i]
            x1 %= (px-1)
        x2 += memo2[i]
        x1 %= (px+1)

for i in range(n):
    if x[-i-1] == "1":
        if px > 1:
            ans.append(solve((x1-memo1[i])%(px-1)) + 1)
        else:
            ans.append(0)
    else:
        ans.append(solve((x2+memo2[i])%(px+1)) + 1)


for ansi in reversed(ans):
    print(ansi)
ans = 0
used = False
mins = [int(input()) for _ in range(5)]
m = min(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
for menu in mins:
  if used==False and menu==m[1]:
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])

### FIXED CODE ###

ans = 0
used = False
mins = [int(input()) for _ in range(5)]
maa = list(map(lambda x:(x%10, x), filter(lambda x:x%10, mins)))
m = (0,0) if len(maa) == 0 else sorted(maa)[0]
for menu in mins:
  if used==False and menu==m[1]:
    used=True
    continue
  ans += (menu//10)*10 + 10*(menu%10>0)
print(ans + m[1])
import numpy as np
from scipy.sparse import *

U = 10
N = int(input())
XY = np.array([input().split() for _ in range(N)], dtype=np.int32)

graph = csr_matrix((np.ones(N,dtype=np.bool), (XY[:,0], U + XY[:,1])), (2*U+1, 2*U+1))
_, component = csgraph.connected_components(graph)

X_cnt = np.bincount(component[:U+1], minlength = U+2)
Y_cnt = np.bincount(component[U+1:], minlength = U+2)
pts_cnt = np.bincount(component[XY[:,0]], minlength = U+2)
answer = (X_cnt * Y_cnt - pts_cnt).sum()
print(answer)

### FIXED CODE ###

# (x,a), (x,b) → (s,a)と(t,b)は同値になる → aとbを同一視
# 連結成分を作る
N = int(input())
U = 10 ** 5
root_x = [None] * (U+1)
root_y = [None] * (U+1)
size_x = [0] * (U+1) # 連結成分のxの個数
size_y = [0] * (U+1) # 連結成分のyの個数
cnt_x = [0] * (U+1) # 生成時に登場した点
cnt_y = [0] * (U+1) # 生成時に登場した点
x_to_y = [None] * (U+1)
y_to_x = [None] * (U+1)

def find_root(root,size,x):
  y = root[x]
  if y is None:
    root[x] = x
    size[x] = 1
    return x
  if x == y:
    return y
  z = find_root(root,size,y)
  root[x] = z
  return z

def merge(root,size,cnt,x,y):
  rx = find_root(root,size,x)
  ry = find_root(root,size,y)
  if rx == ry:
    return
  sx = size[rx]
  sy = size[ry]
  if sx > sy:
    root[ry] = rx
    size[rx] += sy
    cnt[rx] += cnt[ry]
  else:
    root[rx] = ry
    size[ry] += sx
    cnt[ry] += cnt[rx]
  return

for _ in range(N):
  x,y = map(int,input().split())
  rx = find_root(root_x,size_x,x)
  ry = find_root(root_y,size_y,y)
  cnt_x[rx] += 1
  cnt_y[ry] += 1
  if x_to_y[rx] is None:
    x_to_y[rx] = ry
  if y_to_x[ry] is None:
    y_to_x[ry] = rx
  merge(root_y, size_y, cnt_y, x_to_y[rx], ry)
  merge(root_x, size_x, cnt_x, y_to_x[ry], rx)
  x_to_y[root_x[rx]] = root_y[ry]
  y_to_x[root_y[ry]] = root_x[rx]

  
answer = 0

for x in range(1,U+1):
  if root_x[x] is None:
    continue
  rx = find_root(root_x,size_x,x)
  if x != rx:
    continue
  y = x_to_y[x]
  ry = find_root(root_y,size_y,y)
  sx = size_x[rx]
  sy = size_y[ry]
  cnt = cnt_x[rx]
  answer += (sx * sy - cnt)
print(answer)
N = int(input())
L = list(map(int,input().split()))
if max(L) * 2 < L:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
if max(L) * 2 < sum(L):
    print("Yes")
else:
    print("No")
def main():
    h,w = map(int, input().split())
    s = []
    for i in range(h):
        ss = list(input())
        s.append(ss)

    now = [0,0]
    cnt = 0
    if s[0][0] == '#':
        cnt += 1
        # s[0][0] = '.'
    if s[h-1][w-1] == '#':
        # cnt += 1
        # s[h-1][w-1] = '.'

    dp = [[-1] * w for i in range(h)]
    dp[0][0] = cnt

    for i in range(h):
        for j in range(w):
            tmp_up = 100000
            tmp_left = 100000
            change  = 0
            if s[i][j] == '#':
                change = 1
            if i == 0 and j == 0:
                continue
            if i != 0:
                if s[i-1][j] == '#' and s[i][j] == '#':
                    tmp_up = dp[i-1][j]
                else:
                    tmp_up = dp[i-1][j] + change
            if j != 0:
                if s[i][j-1] == '#' and s[i][j] == '#':
                    tmp_left = dp[i][j-1]
                else:

                    tmp_left = dp[i][j-1] + change

            dp[i][j] = min(tmp_up,tmp_left)


    print(dp[h-1][w-1])
    print(dp)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    h,w = map(int, input().split())
    s = []
    for i in range(h):
        ss = list(input())
        s.append(ss)

    now = [0,0]
    cnt = 0
    if s[0][0] == '#':
        cnt += 1
        # s[0][0] = '.'
    

    dp = [[-1] * w for i in range(h)]
    dp[0][0] = cnt

    for i in range(h):
        for j in range(w):
            tmp_up = 100000
            tmp_left = 100000
            change  = 0
            if s[i][j] == '#':
                change = 1
            if i == 0 and j == 0:
                continue
            if i != 0:
                if s[i-1][j] == '#' and s[i][j] == '#':
                    tmp_up = dp[i-1][j]
                else:
                    tmp_up = dp[i-1][j] + change
            if j != 0:
                if s[i][j-1] == '#' and s[i][j] == '#':
                    tmp_left = dp[i][j-1]
                else:

                    tmp_left = dp[i][j-1] + change

            dp[i][j] = min(tmp_up,tmp_left)


    print(dp[h-1][w-1])

if __name__ == '__main__':
    main()
import bisect
x = int(input())
def eratosthenes(limit):
    A = [i for i in range(2,limit+1)]
    P = []
    time = 0
    while True:
        prime = min(A)
        
        if prime > limit**0.5:
            break
        P.append(prime)
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        P.append(a)
    return P
L = eratosthenes(100000)
y = bisect.bisect_left(L,x)
print(L[y])

### FIXED CODE ###

import bisect
x = int(input())
def eratosthenes(limit):
    A = [i for i in range(2,limit+1)]
    P = []
    time = 0
    while True:
        prime = min(A)
        
        if prime > limit**0.5:
            break
        P.append(prime)
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
    for a in A:
        P.append(a)
    return P
L = eratosthenes(100005)
y = bisect.bisect_left(L,x)
print(L[y])
import sys
from functools import lru_cache
sys.setrecursionlimit(10*8)


@lru_cache(maxsize=None)
def dp(x1, x2, x3):
    if x1 == x2 == x3 == 0:
        return 0
    eat1 = dp(x1-1, x2, x3)*(x1/N) if x1 > 0 else 0
    eat2 = dp(x1+1, x2-1, x3)*(x2/N) if x2 > 0 else 0
    eat3 = dp(x1, x2+1, x3-1)*(x3/N) if x3 > 0 else 0
    return (1 + eat1 + eat2 + eat3) * (N/(x1+x2+x3))

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

cnt = [0] * 4
for i in range(N):
    cnt[a[i]] += 1
print(dp(cnt[1], cnt[2], cnt[3]))


### FIXED CODE ###

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

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

    cnt = [0] * 3
    for a in A:
        cnt[a-1] += 1

    dp = [[[0.] * (N+1) for _ in range(N+1)] for _ in range(N+1)]
    for k in range(N+1):
        for j in range(N+1-k):
            for i in range(N+1-j-k):
                ijk = float(i + j + k)
                if ijk == 0:
                    continue
                x = N / ijk
                tmp = 0
                if i > 0:
                    tmp += (dp[i-1][j][k] + x) * (i / ijk)
                if j > 0 and i < N:
                    tmp += (dp[i+1][j-1][k] + x) * (j / ijk)
                if k > 0 and j < N:
                    tmp += (dp[i][j+1][k-1] + x) * (k / ijk)
                dp[i][j][k] = tmp
    print(dp[cnt[0]][cnt[1]][cnt[2]])


if __name__ == '__main__':
    main()
s=input().split()
num=int(input())
ans = ""
for i in range(0, len(s[0]) + 1, num ):
  ans=ans+s[0][i]
print(ans)

### FIXED CODE ###

s=input().split()
num=int(input())
ans = ""
for i in range(0, len(s[0]), num):
  ans=ans+s[0][i]
print(ans)
L,R=map(int,input().split())
l=L//2019
r=R//2019
if l==r:
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            a=i*j
            b=a%2019
            if c>b:
                c=b
        if c==0:
            break
    print(c)
else:
    print(0)

### FIXED CODE ###

L,R=map(int,input().split())
c=2019
z=0
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a=i*j
        b=a%2019
        if c>b:
            c=b
        if c==0:
            z=1
            break
    if z==1:
        break
print(c)
import bisect

N = int(input())
A = list(map(int, input(). split()))
B = list(map(int, input(). split()))
C = list(map(int, input(). split()))

ans = 0

for b in B:
   ans += (bisect.bisect_left(A,b)) *(N - bisect.bisect_right(C,b))

print(ans)

### FIXED CODE ###

A = list(input())
B = list(input())

if (A[0] == B[2] and A[1] == B[1] and A[2] == B[0]):
    print('YES')
else:
    print('NO')
import sys
import math
from operator import mul
from functools import reduce
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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**5
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 )

x,y= (int(_) for _ in input().split()) 
if (x+y)%3!=0:
    print(0)
    sys.exit()
else:
    n=(x+y)/3
    n=int(n)
    if x<n or y<n:
         print(0)
         sys.exit()
    else:
        x=x-n
        y=y-n
        ans=int(cmb(x+y, x,mod))
        print(ans%1000000007)

### FIXED CODE ###

import sys
import math
from operator import mul
from functools import reduce
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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**6
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 )

x,y= (int(_) for _ in input().split()) 
if (x+y)%3!=0:
    print(0)
    sys.exit()
else:
    n=(x+y)/3
    n=int(n)
    if x<n or y<n:
         print(0)
         sys.exit()
    else:
        x=x-n
        y=y-n
        ans=int(cmb(x+y, x,mod))
        print(ans%1000000007)
import math
a, b, n = map(int, input().split())

y = b-1
if x < n:
  x = y
else:
  x = n

print(math.floor(a*x/b))

### FIXED CODE ###

import math
a, b, n = map(int, input().split())

y = b-1
x = 0
if y < n:
  x = y
else:
  x = n
print(math.floor(a*x/b))
a, b, c = (int(i) for i in input().split())
if (a < c && c < b) || (b < c && c < a):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

l = [int(i) for i in input().split()]
l_sorted = sorted(l)
if l[2] == l_sorted[1]:
  print('Yes')
else:
  print('No')
# 文字列の読み込み
s = input()
a = list(s)
if a[2] == a[3] || a[4] == a[5]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

# 文字列の読み込み
s = input()
a = list(s)
if a[2] == a[3] and a[4] == a[5]:
    print('Yes')
else:
    print('No')