Harryxun/stf_run huggingface dataset:
S=str(input())
T=str(input())
ls=len(S)
lt=len(T)

ans=''
for i in range(ls-lt,-1,-1):
  flag=0
  for j in range(lt):
    if not (S[i+j] == T[j] or S[i+j] == '?'):
      flag=1
      break
  if flag==0:
    loc=i
    break

if flag != 0:
  print('UNRESTORABLE')
else:
  i=0
  while i<ls:
    if i==loc:
      ans += T
      i += lt
    elif S[i] == '?':
      ans += 'a'
      i += 1
    else:
      ans += S[i]
      i += 1
  print(ans)


### FIXED CODE ###

S=str(input())
T=str(input())
ls=len(S)
lt=len(T)

ans=''
loc=None
for i in range(ls-lt,-1,-1):
  flag=0
  for j in range(lt):
    if not (S[i+j] == T[j] or S[i+j] == '?'):
      flag=1
      break
  if flag==0:
    loc=i
    break

if loc == None:
  print('UNRESTORABLE')
else:
  i=0
  while i<ls:
    if i==loc:
      ans += T
      i += lt
    elif S[i] == '?':
      ans += 'a'
      i += 1
    else:
      ans += S[i]
      i += 1
  print(ans)
import math
N,K = map(int,input().split())
blue = K
red = N-K
def permutations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // math.factorial(n - r)

for i in range(1,K+1):
  ans = permutations(red+1,i)
  print(ans%(10**9+7))

### FIXED CODE ###

import math
N,K = map(int,input().split())
blue = K
red = N-K
def combinations(n, r):
  if n == r:
    return 1
  else:
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1,K+1):
  if i > N-K+1:
    print(0)
  else:
    ans = (combinations(red+1, i)*combinations(K-1, i-1))%(10**9+7)
    print(ans)
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for x in range(D)])

l_opt = np.array(list(range(1, 27)) * (D // 26) + list(range(1, D % 26 + 1)))
l_max = s.argmax(axis=1) + 1

for day in range(1, D + 1):
    if 2 * s[l_opt[day - 1] - 1] < s[l_max[day - 1] - 1, day + 1]:
        l_opt[day - 1] = l_max[day - 1]

for l in l_opt:
    print(l)

### FIXED CODE ###

import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for x in range(D)])

l_opt = s.argmax(axis=1)
for l in l_opt:
    print(l + 1)
n, a, b = map(int, input().split())

if (b - a)% == 0:
    print((b - a)//2)
else:
    print(min(a - 1, n - b) + 1 +(b - a - 1)//2)

### FIXED CODE ###

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

if (b - a) % 2 == 0:
    print((b - a) // 2)
else:
    print(min(a, n - b + 1) + (b - a - 1) // 2)
N=int(input())
XY=[[] for _ in range(N)]
for i in range(N):
  A=int(input())
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY[i].append([x,y])

ans=0
for bit_state in range(2**N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state>>x).count("1"))
    
print(ans) 


### FIXED CODE ###

N=int(input())
XY=[[] for _ in range(N)]
for i in range(N):
  A=int(input())
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY[i].append([x,y])

ans=0
for bit_state in range(2**N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state).count("1"))
    
print(ans)
list = input().split()
s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if s in t and lent-lens==1 and lens<=10:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

list = [input() for i in range(2)]

s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if t.startswith(s)==True and lent-lens==1 and 1<=lens<=10:
  print("Yes")
else:
  print("No")
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a == b:
    print('YES')
elif v < w:
    print('NO')
else:
    if t < abs(a - b) / (v - w):
        print(abs(a - b) / (v - w))
        print('NO')
    else:
        print('YES')

### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a == b:
    print('YES')
elif v <= w:
    print('NO')
else:
    if t < abs(a - b) / (v - w):
        print('NO')
    else:
        print('YES')
a, b = int(input().sprit(" "))

if a > b
  print("{} > {}".format(a, b))
elif a < b
  print("{} < {}".format(a, b))
elif a eq b
  print("{} == {}".format(a, b))
   

### FIXED CODE ###

a, b = map(int, input().split())

if a > b:
  print("a > b")
elif a < b:
  print("a < b")
elif a == b:
  print("a == b")
n, m = map(int, input().split())
py = []
mli = [0]*m
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = '{0:06d}'.format(p)
    yi = '{0:06d}'.format(mli[p-1])
    li[i] = str(pi)+str(yi)

for i in li:
    print(i)

### FIXED CODE ###

n, m = map(int, input().split())
py = []
mli = [0]*n
li = [""]*m

for i in range(m):
    p,y = map(int, input().split())
    py.append([p,y,i])

py.sort(key=lambda x: x[1])

for p,y,i in py:
    mli[p-1] += 1
    pi = str(p).zfill(6)
    yi = str(mli[p-1]).zfill(6)
    li[i] = pi+yi

for i in li:
    print(i)
import itertools
n,m,q=map(int,input().split())
lis=[i for i  in range(1,m+1)]
lis=list(itertools.combinations(lis,n))
box=[0 for j in range(len(lis))]
for i in range(q):
    que=list(map(int,input().split()))
    for j in range(len(lis)):
        if lis[j][que[1]-1]-lis[j][que[0]-1]==que[2]:
            box[j]+=que[3] 
print(max(box))

### FIXED CODE ###

import itertools
n,m,q=map(int,input().split())
lis=[i for i  in range(1,m+1)]
lis=list(itertools.combinations_with_replacement(lis,n))
box=[0 for j in range(len(lis))]
for i in range(q):
    que=list(map(int,input().split()))
    for j in range(len(lis)):
        if lis[j][que[1]-1]-lis[j][que[0]-1]==que[2]:
            box[j]+=que[3] 
print(max(box))
k = int(input())
alist = list(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
print(alist[k-1])


### FIXED CODE ###

k = int(input())
alist = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(alist[k-1])
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from collections import Counter

def c2s(c):
    s = ''
    for key, val in c:
        # print(key, val)
        s = f'{s}{key}{val}'
    # print(s)
    return s

def choose2(n):
    if n == 1:
        return 0
    return n * (n - 1) // 2

def solve():
    n = II()
    S = [list(input()) for _ in range(n)]

    jisho = {}
    for s in S:
        c = sorted(Counter(s).items(), key=lambda x: x[0])
        # print(c)
        key = c2s(c)
        jisho[key] = jisho.setdefault(key, 0) + 1
    # print(jisho)
    ans = 0
    for val in jisho.values():
        ans = ans + choose2(val)

    print(ans)

if __name__ == '__main__':
    solve()


### FIXED CODE ###

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from collections import Counter

def c2s(c):
    s = ''
    for key, val in c:
        # print(key, val)
        # s = f'{s}{key}{val}'
        s = '{}{}{}'.format(s, key, val)
    # print(s)
    return s

def choose2(n):
    if n == 1:
        return 0
    return n * (n - 1) // 2

def solve():
    n = II()
    S = [list(input()) for _ in range(n)]

    jisho = {}
    for s in S:
        c = sorted(Counter(s).items(), key=lambda x: x[0])
        # print(c)
        key = c2s(c)
        jisho[key] = jisho.setdefault(key, 0) + 1
    # print(jisho)
    ans = 0
    for val in jisho.values():
        ans = ans + choose2(val)

    print(ans)

if __name__ == '__main__':
    solve()
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else:
        return pow(2,x-1,x)==1
N = int(input())
for i in range(N):
    n=int(input())
    c+=is_prime(n)
print(c)

### FIXED CODE ###

def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else: return pow(2,x-1,x)==1
N = int(input())
c=0
for i in range(N):
    c+=is_prime(int(input()))
print(c)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
f = open('/Users/yuigawada/Desktop/競プロ/Atcoder/input.txt', 'r')
sys.stdin = f


import itertools
import numpy as np
import fractions
from itertools import combinations
from functools import reduce
from functools import lru_cache
import math
from collections import deque
import decimal
import bisect
import heapq
# ---*- start -*--- #
import math
import sys
sys.setrecursionlimit(10**9)



def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def solve(N,X,T):
    print(T*math.ceil(N/X))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    solve(N, X, T)



if __name__ == "__main__":
    main()


### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N,X,T=mi()
    print(T*math.ceil(N/X))





if __name__ == "__main__":
    main()
import sys
iN = int(input())
aA = [int(_) for _ in input().split()]

aCol = [0]*(4800//400)
for a in aA:
    aCol[a//400] += 1
iMin = 0
for i in range(8):
    if aCol[i]:
        iMin += 1
iMax = iMin + sum(aCol[8:])
print(iMin,iMax)


### FIXED CODE ###

import sys
iN = int(input())
aA = [int(_)//400 for _ in input().split()]

aCol = [0]*(4800//400 +1)
for a in aA:
    aCol[a] += 1
iMin = 0
for i in range(8):
    if aCol[i]:
        iMin += 1
iMax = iMin + sum(aCol[8:])
if iMin == 0:
    iMin = 1
print(iMin,iMax)
def inpl(): return list(map(int, input().split()))

MOD = 998244353
N= int(input())
D = inpl()
C = Counter(D)

if (D[0] != 0) or (C[0] != 1):
    print(0)
else:
    M = max(C.keys())
    ans = 1
    for i in range(M):
        ans = ans * pow(C[i], C[i+1], MOD) % MOD
    print(ans)

### FIXED CODE ###

from collections import Counter
import sys
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

MOD = 998244353
N= int(input())
D = inpl()
C = Counter(D)

if (D[0] != 0) or (C[0] != 1):
    print(0)
else:
    M = max(C.keys())
    ans = 1
    for i in range(M):
        ans = ans * pow(C[i], C[i+1], MOD) % MOD
    print(ans)
N=input()
p=input()
N=int(N.split()[0])
p=p.split()
p=[int(p) for p in p]
numlist=sorted(p)

if numlist==p:
        output="YES"
else: 
    dist=0    
    for s,t in zip(numlist,p):
        if s!=t:
                dist=dist+1
        else:
#                dist=dist+0
            pass
    if dist=2:
        output="YES"
    else :
        output="NO"        
print(output)

### FIXED CODE ###

N=input()
p=input()
N=int(N.split()[0])
p=p.split()
p=[int(p) for p in p]
numlist=sorted(p)

if numlist==p:
        output="YES"
else: 
    dist=0    
    for s,t in zip(numlist,p):
        if s!=t:
                dist=dist+1
        else:
#                dist=dist+0
            pass
    if dist==2:
        output="YES"
    else :
        output="NO"        
print(output)
s=input()
len_s=len(s)

if(len_s%2==1):
    l=len_s//2
    r=l
else:
    r=len_s//2
    l=r-1

saisyo=s[l]
if(s[l]==s[r]):
    while(saisyo==s[l-1] and saisyo==s[r+1]):
        l-=1
        r+=1
        if(l<0):
            break
else:
    r=l

print( (len_s + r-l +1)//2)

### FIXED CODE ###

import sys
s=input()
len_s=len(s)
if(len_s==1):
    print(1)
    sys.exit()


if(len_s%2==1):
    l=len_s//2
    r=l
else:
    r=len_s//2
    l=r-1

saisyo=s[l]
if(s[l]==s[r]):
    while(0<l and saisyo==s[l-1] and saisyo==s[r+1]):
        l-=1
        r+=1

else:
    r=l

print( (len_s + r-l +1)//2)
S = input()
if S = "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)

### FIXED CODE ###

S = input()
if S == "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)
import sys

def resolve():
    A, B, K = list(map(int, input().split(" ")))
    L = list(range(A, B+1))
    for s in sorted(list(set(L[:K]+L[-K:]))):
        print(s)

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

import sys

def resolve():
    A, B, K = list(map(int, input().split(" ")))
    out = []
    for i in range(A, A+K):
        if i <= B:
            out.append(i)
    for j in range(B-K+1, B+1):
        if j >= A and not j in out:
            out.append(j)
    
    [print(s) for s in out]

if '__main__' == __name__:
    resolve()
N=int(input())

G=[[] for i in range(N)]
for i in range(N-1):
	a,b,c=map(lambda x:int(x)-1,input().split())
	G[a].append([b,c+1])
	G[b].append([a,c+1])

Q,K=map(int,input().split())
A=[list(map(int,input().split())) for i in range(Q)]


depth=[0 for i in range(N)]
depth[K-1]=0

def dfs(cur,p,d):
	for i,j in G[cur]:
		if i!=p:
			depth[i]=d+j
			dfs(i,cur,d+j)

dfs(K-1,-1,0)


for i,j in A:
	print(depth[i-1]+depth[j-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N=int(input())

G=[[] for i in range(N)]
for i in range(N-1):
	a,b,c=map(lambda x:int(x)-1,input().split())
	G[a].append([b,c+1])
	G[b].append([a,c+1])

Q,K=map(int,input().split())
A=[list(map(int,input().split())) for i in range(Q)]


depth=[0 for i in range(N)]
depth[K-1]=0

def dfs(cur,p,d):
	for i,j in G[cur]:
		if i!=p:
			depth[i]=d+j
			dfs(i,cur,d+j)

dfs(K-1,-1,0)


for i,j in A:
	print(depth[i-1]+depth[j-1])
N = int(input())

if N == 1:
  print("Hello World")
else if N == 2:
  A = int(input())
  B = int(input())
  print(A + B)


### FIXED CODE ###

N = int(input())

if N == 1:
  print("Hello World")
else :
  A = int(input())
  B = int(input())
  print(A + B)
N = int(input())
A = list(map(int,input().split()))

D = [0] * (10**6 + 1)
A.sort()
for i in range(N):
    D[A[i]] += 1
    
ans = 0
for i in range(1, 10**6+1):
    if D[i]:
        if D[i]==1:
            ans += 1
        for j in range(i,m,i):
            D[j] = 0
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
m = max(a) + 10
li = [0]*m 
for x in a:
    li[x] += 1
ans = 0
for i in range(1,m):
    if li[i]: 
        if li[i]==1: 
            ans += 1 
        for j in range(i,m,i): 
            li[j] = 0
print(ans)
import numpy as np

N = int(input())

A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


def yes_or_no():
    for c in C:
        if c < 0:
            return 0
    
    sorted_index = np.argsort(B)
    sum_A = [A[sorted_index[0]]]
    for i in range(1, N):
        next_num = sum_A[i-1] + A[sorted_index[i]]
        sum_A.append(next_num)
        if next_num > B[sorted_index[i]]:
            print(sum_A)
            return 0
        
    return 1

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

### FIXED CODE ###

import numpy as np

N = int(input())

A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


def yes_or_no():
    sorted_index = np.argsort(B)
    if A[sorted_index[0]] > B[sorted_index[0]]:
        return 0
    sum_A = [A[sorted_index[0]]]
    for i in range(1, N):
        next_num = sum_A[i-1] + A[sorted_index[i]]
        sum_A.append(next_num)
        if next_num > B[sorted_index[i]]:
            return 0
        
    return 1

if yes_or_no():
    print("Yes")
else:
    print("No")
a=int(input())
s=input()
r=s.count(R)
if a-r<r:
    print("Yes")
else:
    print("No")

    

### FIXED CODE ###

a=int(input())
s=list(input())
x=s.count("R")
y=a-x
if x>y:
    print("Yes")
else:
    print("No")
def uf_init(n):
    return list(range(n))

def uf_root(uf, x):
    if uf[x] != x:
        uf[x] = uf_root(uf, uf[x])
    return uf[x]

def uf_same(uf, x, y):
    return uf_root(uf, x) == uf_root(uf, y)

def uf_unite(uf, x, y):
    x = uf_root(uf, x)
    y = uf_root(uf, y)
    if x == y:
        return
    uf[x] = y

N,M = (int(x) for x in input().split())

uf = uf_init(N)

for _ in range(M):
    X,Y,Z = (int(x) for x in input().split())
    uf_unite(uf, X-1, Y-1)

uf_roots = set()
for i in range(N):
    uf_roots.add(uf_root(uf, i))

print(len(uf_roots))



### FIXED CODE ###

def uf_init(n):
    return list(range(n))

def uf_root(uf, x):
    update_node_arr = []
    while(uf[x] != x):
        update_node_arr.append(x)
        x = uf[x]
    for y in update_node_arr:
        uf[y] = x
    return x

def uf_same(uf, x, y):
    return uf_root(uf, x) == uf_root(uf, y)

def uf_unite(uf, x, y):
    x = uf_root(uf, x)
    y = uf_root(uf, y)
    if x == y:
        return
    uf[x] = y

N,M = (int(x) for x in input().split())

uf = uf_init(N)

for _ in range(M):
    X,Y,Z = (int(x) for x in input().split())
    uf_unite(uf, X-1, Y-1)

uf_roots = set()
for i in range(N):
    uf_roots.add(uf_root(uf, i))

print(len(uf_roots))
# Nがノードの数, Qが操作回数
N, Q = map(int, input().split())

points = [0] * N
nodes = [set() for _ in range(N)]
parents = [-1] * N

for _ in range(N - 1):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  nodes[a].add(b)
  nodes[b].add(a)

def fill_parent(parent, n):
  global parents, nodes
  parents[n] = parent
  if parent in nodes[n] and len(nodes[n]) == 1:
    return
  for i in nodes[n]:
    if i != parent:
      fill_parent(n, i)

for i in nodes[0]:
  fill_parent(0, i)

h = {}
for i in range(N):
  if parents[i] not in h:
    h[parents[i]] = set()
  h[parents[i]].add(i)

# print(h)
for _ in range(Q):
  p, x = map(int, input().split())
  p -= 1
  points[p] += x

c = [0] * N

def calc(n):
  if n == 0:
    c[n] = points[n]
  else:
    c[n] = points[n] + c[parents[n]]
  if n in h:
    for i in h[n]:
      calc(i)

calc(0)
print(*c)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

def main():
  input = sys.stdin.buffer.readline
  read = sys.stdin.buffer.read
  # Nがノードの数, Qが操作回数
  N, Q = map(int, input().split())
  ABPX = list(map(int, read().split()))
  AB = iter(ABPX[:N+N-2])
  PX = iter(ABPX[N+N-2:])

  parents = [None] * N
  childrens = [set() for _ in range(N)]
  relations = [[] for _ in range(N)]
  shown = set()

  for a, b in zip(AB, AB):
    a -= 1
    b -= 1
    relations[a].append(b)
    relations[b].append(a)

  points = [0] * N
  result = [0] * N

  for p, x in zip(PX, PX):
    p -= 1
    points[p] += x

  def solve(parent, relations, points, result):
    result[parent] += points[parent]
    shown.add(parent)
    for child in relations[parent]:
      if child not in shown:
        result[child] += result[parent]
        solve(child, relations, points, result)
      
  solve(0, relations, points, result)
  print(*result)

if __name__ == "__main__":
  main()
N,A,B = map(int,input().split())
for M in range(1,N+1,1)
  n =　str(M)
  a=0
  b=0
  c=0
  d=0
  e=0
  y=0
  if N=10000:
    e=n[0]
  if 1000<=N<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=N<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=N<100:
    b=n[0]
    a=n[1]
  if N<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
  print(y)





### FIXED CODE ###

N,A,B = map(int,input().split())
a=0
b=0
c=0
d=0
e=0
y=0
for i in range(1,N+1,1):
  n = str(i)
 
  if int(n)==10000:
    e=n[0]
    d=n[1]
    c=n[2]
    b=n[3]
    a=n[4]
  if 1000<=int(n)<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=int(n)<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=int(n)<100:
    b=n[0]
    a=n[1]
  if int(n)<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
print(y)
count = 0
while 1:
    a = raw_input()
    b = a[::-1]
    if a == b: count+=1
    print count

    

### FIXED CODE ###

count = 0
try:
    while 1:
        a = raw_input()
        b = a[::-1]
        if a == b: count+=1
except EOFError: pass
print count
x, y = map(int, input().split())
tmp = 2*y - x
if tmp%3 != 0:
    print(0)
    exit()
up = tmp // 3
total = y - up*2 + up

n = total
k = up
mod = 10**9 + 7

if k == 0:
    print(n)

modinv_table = [-1] * (k+1)
modinv_table[1] = 1
for i in range(2, k+1):
    modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod
    
def binomial_coefficients(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

print(binomial_coefficients(n, k))

### FIXED CODE ###

x, y = map(int, input().split())
tmp = 2*y - x
if tmp%3 != 0:
    print(0)
    exit()
up = tmp // 3
total = y - up*2 + up

n = total
k = up
mod = 10**9 + 7

#print(n)
#print(k)

if k == 0:
    print(1)
    exit()
try:
    modinv_table = [-1] * (k+1)
    modinv_table[1] = 1
    for i in range(2, k+1):
        modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod
except:
    k = total - up
    modinv_table = [-1] * (k + 1)
    modinv_table[1] = 1
    for i in range(2, k + 1):
        modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod

def binomial_coefficients(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

print(binomial_coefficients(n, k))
import re
# イテレーションのため
input()
S = input()
K = int(input())

print(re.sub(r'[^%s]' %S[K] , '*', S))

### FIXED CODE ###

import re
# イテレーションのため
input()
S = input()
K = int(input())

print(re.sub(r'[^%s]' %S[K - 1] , '*', S))
import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

def f(a):
    if a == 0:
        return 1
    else:
        return a * f(a - 1)
  
cnt = 0
for (c, m) in collections.Counter(s):
	combi = f(m - 1)
    if combi != 1:
        cnt += combi
    
print(cnt)

### FIXED CODE ###

import collections  

n = int(input())

s = []
for i in range(n):
    s.append(str(sorted(input())))

cnt = 0
for (c, m) in collections.Counter(s).items():
    cnt += m * (m - 1) // 2
    
print(cnt)
import sys
S = input()
cnt = [False] * 30
for i in S:
    if i in "abcdefghijklmnopqrstuvwxyz"
        cnt[ord(i) - ord('a')] = True
 
for i in range(len(cnt)):
    if not cnt[i]:
        print(chr(ord('a')+i))
        sys.exit()
print("None")

### FIXED CODE ###

import sys
S = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"

for s in alphabet:
    if s not in S:
        print(s)
        sys.exit()

print("None")
# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *100
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(raw_input())
l = []
for i in range(n):
  l.append(int(raw_input()))
#print(l)

flag = [0] *110
#print(flag)
for j in l:
  if flag[j] == 0:
    flag[j] = 1
#print(flag)

num = 0
for k in flag:
#  print(k)
  if k == 1:
    num += 1
print(num)

"""
##これだとエラーでる
##flag[k]だとflag[0]かflag[1]にしかならないことに注意
num = 0
for k in flag:
  print(flag[k])
  if flag[k] == 1:
    num += 1
print(num)
"""