Harryxun/stf_run huggingface dataset:
from collections import defaultdict as dd
import sys
import math
n, m = map(int, input().split())
dic = dd(int)

#M=1
if m == 1:
    print(1)
    sys.exit()
elif n == 1:
    print(1)
    sys.exit()

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

for i in range(2, math.ceil(m**0.5) + 3):
    while m % i == 0:
        m //= i
        dic[i] += 1
else:
    m != 1:
        dic[m] = 1
#print(dic)

ans = 1
mod = 10**9 + 7
for count in dic.values():
    ans *= combinations_count(count + n - 1, n-1) % mod

print(ans % mod)

### FIXED CODE ###

from collections import defaultdict as dd
from sys import exit
import math
n, m = map(int, input().split())
dic = dd(int)

#M=1
if m == 1:
    print(1)
    exit()

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

for i in range(2, math.ceil(m**0.5) + 3):
    while m % i == 0:
        m //= i
        dic[i] += 1
if m != 1:
    dic[m] = 1
#print(dic)

ans = 1
mod = 10**9 + 7
for count in dic.values():
    ans *= combinations_count(count + n - 1, n-1) % mod

print(ans % mod)
A = int(input())
print("%h:%m:%s"%(A/3600,(A%3600)/60,A%60))


### FIXED CODE ###

A = int(input())
print("%d:%d:%d"%(A/3600,(A%3600)/60,A%60))
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ans = 0
t = 0
a = 0
b = 0

while True:
    if not t + A[a] > K:
        t += A[a]
        a += 1
        # print(a, t, A[a-1])
        if a >= N:
            break
    else:
        break

flug = True     #全探索を行うか
while True:
    if not t + B[b] > K:
        t += B[b]
        b += 1
        # print(b, t, B[b-1])
        if b >= M:
            flug = False
            break
    else:
        break

# print(a, b, flug)
ans = a + b
flug2 = True    #処理を続けるか
if flug:
    while True:
        a -= 1
        t -= A[a]
        while True:
            if not t + B[b] > K:
                t += B[a]
                b += 1
                if b >= M:
                    flug2 = False
                    break
            else:
                break
        ans = max(ans, a + b)
        if not flug2:
            break
print(ans)

### FIXED CODE ###

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

ans = 0
t = 0
a = 0
b = 0

while True:
    if not t + A[a] > K:
        t += A[a]
        a += 1
        # print(a, t, A[a-1])
        if a >= N:
            break
    else:
        break

flug = True     #全探索を行うか
while True:
    if not t + B[b] > K:
        t += B[b]
        b += 1
        # print(b, t, B[b-1])
        if b >= M:
            flug = False
            break
    else:
        break

# print(a, b, flug)
ans = a + b
flug2 = True    #処理を続けるか
if flug:
    while True:
        a -= 1
        if a < 0:
            break
        t -= A[a]
        while True:
            if not t + B[b] > K:
                t += B[b]
                b += 1
                if b >= M:
                    flug2 = False
                    break
            else:
                break
        ans = max(ans, a + b)
        if not flug2:
            break
print(ans)
age = int(input())
price = int(input())
if age >= 13:
    print(age, price)
elif 6 <= age <= 12:
    print(price // 2)
else:
    print(0)

### FIXED CODE ###

a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6 and a <= 12:
    print(int(b /2))
else:
    print(0)
from bisect import bisect, bisect_left

n = int(input())
x = list(map(int, input().split()))
l = int(input())

def search_1(start):
	return bisect(x, x[start] + l) - 1

route = [[] for _ in range(n)]

i = 0 # 親の位置
for i in range(n - 1):
	if route[i] == []:
		j = search_1(i) # カーソルの位置
		num = 1 # 何日目の場所か
		route[i].append(j)
		if route[j] == []:
			route[j] = (i, num)
		else: # 既に他の親が通っている
			route[i] += route[route[j][0]][route[j][1]:]
			continue
		while j < n - 1:
			j = search_1(j)
			num += 1
			route[i].append(j)
			if route[j] == []:
				route[j] = (i, num)
			else: # 既に他の親が通っている
				route[i] += route[route[j][0]][route[j][1]:]
				break
	else:
		continue

# print(route)

def search_2(start, goal):
	if type(route[start]) == type([]):
		return bisect_left(route[start], goal) + 1
	else:
		return bisect_left(route[route[start][0]][route[start][1]:], goal) + 1



q = int(input())
for _ in range(q):
	a, b = map(int, input().split())
	if a > b:
		a, b = b, a
	print(search_2(a - 1, b - 1))


### FIXED CODE ###

from bisect import bisect

n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())

#r[i][j]: jから(2**i)日で行ける右端
r = [[i for i in range(n)] for _ in range(18)]
for j in range(n):
	r[0][j] = bisect(x, x[j]+l) - 1
for i in range(1, 18):
	for j in range(n):
		r[i][j] = r[i-1][r[i-1][j]]

def search(x, y):
	res = 0
	cur = x
	while True:
		for i in range(18):
			if r[i][cur] >= y:
				if i == 0:
					return res+1
				cur = r[i-1][cur]
				res += 1 << (i-1) 
				break

for _ in range(q):
	a, b = map(int, input().split())
	print(search(min(a, b)-1, max(a, b)-1))
H, W = map(int, input().split(" "))

s = [list(input()) for _ in range(0, H)]

d = {}
def walk(i, j, x):
	x += 1
	if (i, j) not in d or x < d[(i, j)]:
		d[(i, j)] = x
		if i-1 > 0 and s[i-1][j] == '.':
			walk(i-1, j, x)
		if j-1 > W and s[i][j-1] == '.':
			walk(i, j-1, x)
		if i+1 < H and s[i+1][j] == '.':
			walk(i+1, j, x)
		if j+1 < W and s[i][j+1] == '.':
			walk(i, j+1, x)

walk(0, 0, 0)
if (H-1, W-1) in d:
	print("".join(map(lambda x: "".join(x), s)).count(".") - d[(H-1, W-1)])
else:
	print(-1)


### FIXED CODE ###

INF=10*10
H,W=map(int, input().split())
s=[list(input()) for _ in range(H)]
wall=sum(map(lambda x: x.count("#"), s))
d=[[INF for _ in range(W)] for _ in range(H)]
def bfs(h, w, c):
	if d[h][w] <= c:
		return
	d[h][w] = c
	for dh,dw in [(0, -1), (-1, 0), (0, 1), (1, 0)]:
		if h+dh >= 0 and w+dw >= 0 and h+dh < H and w+dw < W and s[h+dh][w+dw] == ".":
			bfs(h+dh, w+dw, c+1)
bfs(0, 0, 1)
print(-1 if d[H-1][W-1] == INF else H*W - d[H-1][W-1] - wall)
s = input()
if s=="SUN":
  print(7)
elif s=="MON":
  print(6)
elif s=="TUE":
  print(5)
else s=="WED":
  print(4)
else s=="THU":
  print(3)
else s=="FRI":
  print(2)
else s=="SAT":
  print(1)

### FIXED CODE ###

s = input()
if s=="SUN":
  print(7)
elif s=="MON":
  print(6)
elif s=="TUE":
  print(5)
elif s=="WED":
  print(4)
elif s=="THU":
  print(3)
elif s=="FRI":
  print(2)
elif s=="SAT":
  print(1)
x, t = map(int, input().split())
ans = x - t
if ans < 0:
  ans = 0
 print(ans)

### FIXED CODE ###

x, t = map(int, input().split())
ans = x - t
if ans < 0:
  ans = 0
print(ans)
N = input()

num = [int(i) for i in N]
f = sum(num)
if N%f == 0:
    print("Yes")
else:
    print('No')


### FIXED CODE ###

N = input()

num = [int(i) for i in N]
f = sum(num)
if int(N)%f == 0:
    print("Yes")
else:
    print('No')
print(r*r)


### FIXED CODE ###

print(int(input()) ** 2)
[w,h,x,y]=[int(i) for i in input().split()]

print(double(w*h/2))
if x*2=w and y*2=h:
    print(1)
else print(0)


### FIXED CODE ###

[w,h,x,y]=[int(i) for i in input().split()]

a=int(0)

if x*2==w and y*2==h:
    a=int(1)
else:
    a=int(0)

print(str(w*h/2)+" "+str(a))
n = int(input())
l = []
ans = 1
for _ in range(n) :
	l.append(int(input()))
if l[0] == 2 :
	print(1)
else :
    i = l[0] - 1
	while True :
		if l[i] == 2 :
			ans += 1
			break
		i = l[i] - 1
		ans += 1
		if ans == n+1 :
			print(-1)
			exit()
	print(ans)

### FIXED CODE ###

n = int(input())
l = []
ans = 1
for _ in range(n) :
	l.append(int(input()))
if l[0] == 2 :
	print(1)
else :
    i = l[0] - 1
    while True :
        if l[i] == 2 :
            ans += 1
            break
        i = l[i] - 1
        ans += 1
        if ans == n+1 :
            print(-1)
            exit()
    print(ans)
n=int(input())
s=[input() for i in range(n)]
dic={}
for i in range(n):
  for j in s[i]:
    if not(j in dic[s[i]]):
      dic[j]=[0 for i in range(n)]
    dic[j][i]+=1
ans=[]
for i in dic.keys():
  ans.append(i*min(dic[i]))
ans.sort()
print(ans,sep='')

### FIXED CODE ###

n=int(input())
s=[input() for i in range(n)]
dic={}
for i in range(n):
  for j in s[i]:
    if not(j in dic):
      dic[j]=[0 for i in range(n)]
    dic[j][i]+=1
ans=[]
for i in dic.keys():
  ans.append(i*min(dic[i]))
ans.sort()
print(*ans,sep='')
a = input()
b = input()
print(''.join([a[i]+b[i] for i in range(o,max(len(a),len(b)))]))

### FIXED CODE ###

a = list(input())
b = list(input())+[""]
for x,y in zip(a,b):
  print(x+y, end = "")
from collections import Counter

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

V1 = [V[i] for i in range(0, len(V), 2)]
V2 = [V[i] for i in range(1, len(V), 2)]

x = Counter(V1).most_common(2)
y = Counter(V2).most_common(2)
if x[0][1] < y[0][1]:
    x, y = y, x
elif x[0][1] == y[0][1] and x[1][1] > y[1][1]:
    x, y = y, x

l = int(N / 2)
res = l - x[0][1]
if y[0][0] == x[0][0]:
    res += l - (y[1][1] if len(y) > 1 else 0)
else:
    res += l - y[0][1]

print(res)


### FIXED CODE ###

from collections import Counter

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

V1 = [V[i] for i in range(0, len(V), 2)]
V2 = [V[i] for i in range(1, len(V), 2)]

x = Counter(V1).most_common(2)
y = Counter(V2).most_common(2)

if x[0][1] < y[0][1]:
    x, y = y, x
elif len(x)>1 and len(y) > 1 and x[0][1] == y[0][1] and x[1][1] > y[1][1]:
    x, y = y, x

l = int(N / 2)
res = l - x[0][1]
if y[0][0] == x[0][0]:
    res += l - (y[1][1] if len(y) > 1 else 0)
else:
    res += l - y[0][1]

print(res)
#input
N, K = map(int, input().split())
A = list(map(int, input().split()))

#output
import numpy as np
import math
A = np.array(A)
A = np.sort(A)

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

q = np.full(N, 0)
for i in range(N-K+1):
    q[i] = cmb(N-i-1, N-K-i)

r = -q + np.flip(q)

print((A*r).sum() % (10**9 + 7))

### FIXED CODE ###

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

#output
import math

A.sort()
mod = 10**9+7

n_ = 10**5 + 3
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod
#これだとTLE!
"""
def cmb(n, r):
    if n < r: return 0
    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
"""

M = 0
m = 0
for i, a in enumerate(A):
    M += cmb(i, K-1) * a
    m += cmb(N-i-1, K-1) * a
    M %= mod
    m %= mod

print((M-m) % mod)
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N, K = mi()
S = input()

len_list = []
if S[0] == '1' and S[1] != '1':
    len_list.append(0)

cnt = 1
for i in range(1, N):
    if S[i] != S[i-1]:
        len_list.append(cnt)
        cnt = 1
    else:
        cnt += 1
len_list.append(cnt)

#print(len_list)
i = 0
wa = 0
while True:
    if i+2*K+1 < N:
        wa = max(wa, sum(len_list[i:i+2*K+1]))
    else:
        wa = max(wa, sum(len_list[i:]))
        break
    i += 2
print(wa)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N, K = mi()
S = input()
inds = [[0, 0]]

flag = 0
s = 0
for i in range(N):
    if S[i] == '0':
        if not flag:
            flag = 1
            inds.append([s, i-1])
    else:
        if flag:
            s = i
        flag = 0
if flag:
    inds.append([N-1, N-1])
if not flag:
    inds.append([s, N-1])
#print(inds)
l_inds = len(inds)
wa = 0
if K >= l_inds-1:
    print(N)
    exit()
for i in range(l_inds-K):
    wa = max(inds[i+K][1] - inds[i][0] + 1, wa)

print(wa)
# coding: utf-8
import itertools
A = [0]
N, S = list(map(int, input().split()))
A = A + list(map(int, input().split()))   
val = 0
for L in range(1, N+1):
  for R in range(L, N+1):
    A_ = A[L:R+1]
    lists = []
    for n in range(len(A_)):
      for comb in itertools.combinations(A_, n+1):
        lists.append(list(comb))
    for lis in lists:
      _sum = sum(lis)
      if _sum == S:
        val += 1
      if val == 998244353:
        val = 0
print(val)


### FIXED CODE ###

N, M = input().split()
N, M = int(N), int(M)
if N < 2:
  print(int(M*(M-1)/2))
elif M < 2:
  print(int(N*(N-1)/2))
else:
  print(int(N*(N-1)/2 + M*(M-1)/2))
n,m = map(int,input().split())

import heapq

def dijkstra(s):
    hq = [(0, s)]
    heapq.heapify(hq) # リストを優先度付きキューに変換
    cost = [float('inf')] * n # 行ったことのないところはinf
    cost[s] = 0 # 開始地点は0
    while hq:
        c, v = heapq.heappop(hq)
        if c > cost[v]: # コストが現在のコストよりも高ければスルー
            continue
        for d, u in e[v]:
            tmp = d + cost[v]
            if tmp < cost[u]:
                cost[u] = tmp
                heapq.heappush(hq, (tmp, u))
    return cost

e = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1, b-1
    e[a].append((1, b))
    e[b].append((1, a)) # 有向グラフでは削除

d = dijkstra(0)
# print(d)
ans = [1]*(n)
for i in range(1,n):
    for j in e[i][1]:
        print(i,j)
        if d[j] == d[i] - 1:
            ans[i] = j + 1

print(*ans[1:], sep="\n")

### FIXED CODE ###

n,m = map(int,input().split())

import heapq

def dijkstra(s):
    d = 1
    hq = [(0, s)]
    heapq.heapify(hq) # リストを優先度付きキューに変換
    cost = [float('inf')] * n # 行ったことのないところはinf
    cost[s] = 0 # 開始地点は0
    while hq:
        c, v = heapq.heappop(hq)
        if c > cost[v]: # コストが現在のコストよりも高ければスルー
            continue
        for u in e[v]:
            tmp = 1 + cost[v]
            if tmp < cost[u]:
                cost[u] = tmp
                heapq.heappush(hq, (tmp, u))
    return cost

e = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1, b-1
    e[a].append(b)
    e[b].append(a) # 有向グラフでは削除

d = dijkstra(0)
# print(d)
# print(e)
ans = [0]*(n)
for i in range(1,n):
    for j in e[i]:
        # print(i,j)
        if d[j] == d[i] - 1:
            ans[i] = j + 1
            continue

print("Yes")
print(*ans[1:], sep="\n")
data=input().split()
ans=1
count=0

for i in data:
  if int(i)<=9:
    ans*=int(i)
  if int(i)>9:
    count+=1
    
if count>=1:
  print("-1")
elif cuont==0:
  print(ans)

### FIXED CODE ###

data=input().split()
sum=0

for i  in data:
  if int(i)>=10:
    sum+=1
if sum==0:
  print(int(data[0])*int(data[1]))
else:
  print("-1")
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#N=int(input())
#S=[list(map(int,input().split())) for i in range(N)]
xs,ys,xt,yt=map(int,input().split())
N=int(input())
XYR=[list(map(int,input().split())) for i in range(N)]
XYR.append([xt,yt,0])#終点
XYR.append([xs,ys,0])#開始
kyori=[[0 for i in range(len(XYR))] for n in range(len(XYR))]
for i in range(len(XYR)):
    for m in range(i,len(XYR)):
        if i==m:
            t=0
        else:
            x1,y1,r1=XYR[i]
            x2,y2,r2=XYR[m]
            t=max(((x2-x1)**2+(y2-y1)**2)**.5-r1-r2,0)

        kyori[i][m]=t
        kyori[m][i]=t

stack=sorted(kyori[-2])
heapify(stack)
Pdic={}
dic={}
kyoriset=set()
for i in range(len(XYR)):
    Pdic.update({i:kyori[-1][i]})
    if not kyori[-1][i] in kyoriset:
        kyoriset.add(kyori[-1][i])
        dic.update({kyori[-1][i]:[i]})
    else:
        dic[kyori[-1][i]].append(i)

visited=set([len(XYR)-1])
#print(Pdic)
#print(dic)
#print(stack)
while stack:
    m=heappop(stack)
    a=dic[m].pop()
    if a==len(XYR)-2:
        print(m)
        exit()
    if not a in visited:
        visited.add(a)
        for i in range(len(XYR)):
            nm=kyori[a][i]+m
            #if Pdic[i]>nm:
            #    Pdic[i]=nm
            heappush(stack,nm)
            if not nm in kyoriset:
                kyoriset.add(nm)
                dic.update({nm:[i]})
            else:
                dic[nm].append(i)


### FIXED CODE ###

from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
#N=int(input())
#S=[list(map(int,input().split())) for i in range(N)]
idle=10**13
xs,ys,xt,yt=map(int,input().split())
N=int(input())
XYR=[list(map(int,input().split())) for i in range(N)]
XYR.append([xt,yt,0])#終点
XYR.append([xs,ys,0])#開始
"""for i in range(len(XYR)):
    XYR[i][0]*=idle
    XYR[i][1]*=idle
    XYR[i][2]*=idle"""
kyori=[[0 for i in range(len(XYR))] for n in range(len(XYR))]
for i in range(len(XYR)):
    for m in range(i,len(XYR)):
        if i==m:
            t=0
        else:
            x1,y1,r1=XYR[i]
            x2,y2,r2=XYR[m]
            t=max(((x2-x1)**2+(y2-y1)**2)**.5-r1-r2,0)

        kyori[i][m]=t
        kyori[m][i]=t
stack=sorted(kyori[-1])
heapify(stack)
Pdic={}
dic={}
kyoriset=set()
for i in range(len(XYR)):
    a=kyori[-1][i]
    Pdic.update({i:a})
    if not a in kyoriset:
        kyoriset.add(a)
        dic.update({a:[i]})
    else:
        dic[a].append(i)
visited=set([len(XYR)-1])
while stack:
    m=heappop(stack)
    a=dic[m].pop()
    if a==len(XYR)-2:
        print(m)
        exit()
    if not a in visited:
        visited.add(a)
        for i in range(len(XYR)):
            nm=kyori[a][i]+m
            if Pdic[i]>nm:
                Pdic[i]=nm
                heappush(stack,nm)
                if not nm in kyoriset:
                    kyoriset.add(nm)
                    dic.update({nm:[i]})
                else:
                    dic[nm].append(i)
n, k = map(int, input().split())
a =list(map(int, input().split()))
ball = 0
count = [0]*(n+1)
for i in range(n):
    count[a[i]] += 1

count = count.sorted(reverse=True)
for i in range(k):
    ball += count[i]

print(n - ball)



### FIXED CODE ###

n, k = map(int, input().split())
a =list(map(int, input().split()))
ball = 0
count = [0]*(n+1)
for i in range(n):
    count[a[i]] += 1

count.sort(reverse=True)
for i in range(k):
    ball += count[i]

print(n - ball)
x,n = map(int, input().split())
p = list(map(int, input().split()))
d = []
c=0
if n == 0:
    print(x)
else:
    for e in p:
        d.append( abs(e-x))
    s = d[0]
    for i in range(len(d)):
        if d[i] < s:
            s = i
            z = p[i]
    for j in range(1,100):
        for g in p:
            if z+j != g:
                c +=1
                w1 = z+j
        if c == n:
            break
        c = 0
    c=0
    for j in range(1,100):
        for g in p:
            if z-j != g:
                c +=1
                w2 = z-j
        if c == n:
            break
        c = 0

    if abs(w1-x) < abs(w2-x):
        print(w1)
    else:
        print(w2)

### FIXED CODE ###

x,n = map(int, input().split())

if n == 0:
    print(x)
elif n ==100:
    if x >50:
        print(101)
    else:
        print(0)
else:
    p = list(map(int, input().split()))
    d = []
    c=0
    for e in p:
        d.append(abs(e-x))
    d1 = d[0]
    z=p[0]
    for i in range(len(d)):
        if d[i] < d1:
            d1 = d[i]
            z = p[i]
    for j in range(1,100):
        for g in p:
            if z+j != g:
                c +=1
                w1 = z+j
        if c == n:
            break
        c = 0
    c=0
    for j2 in range(1,100):
        for g2 in p:
            if z-j2 != g2:
                c +=1
                w2 = z-j2
        if c == n:
            break
        c = 0
    if w2 < 0:
        print(w1)
    elif abs(w1-x) < abs(w2-x):
        print(w1)
    else:
        print(w2)
n = int(input()) 
a = list(map(int,input().split())) 
sa = sorted(a) 

if n % 2 == 0:
  k = 1
  l = 0
else:
  k = 0
  l = 1 

a=1000000007
lag = True 
for i,s in enumerate(sa):
  if ((i+l)//2)*2+k != s:
    flag = False
if flag:
  print(2**(n//2) % a)
else:
  print(0) 

### FIXED CODE ###

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

if n % 2 == 0:
  k = 1
  l = 0
else:
  k = 0
  l = 1 

a=1000000007
flag = True 
for i,s in enumerate(sa):
  if ((i+l)//2)*2+k != s:
    flag = False
if flag:
  print(2**(n//2) % a)
else:
  print(0)
import math
x,y = map(int,input().split())
sum_xy = x+y

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 )

if sum_xy%3!=0:
    print(0)
else:
    #a+b
    ab_sum = sum_xy//3
    a = x-ab_sum
    b = y-ab_sum
#     a_kaizyo = 1
#     b_kaizyo = 1
#     ab_kaizyo = 1
#     for i in range(1,a+1):
#         temp =  a_kaizyo*i
#         a_kaizyo = temp%inf
#     for i in range(1,b+1):
#         temp =  b_kaizyo*i
#         b_kaizyo = temp%inf
#     for i in range(1,ab_sum+1):
#         temp =  ab_kaizyo*i
#         ab_kaizyo = temp%inf

    print(cmb(ab_sum,a,inf))
    


### FIXED CODE ###

x, y = map(int, input().split())
if (x+y)%3 != 0:
    print(0)
    exit()

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 )
 
 
a = (2*x-y)//3
b = (2*y-x)//3
n = a+b
r = a
res = cmb(n,r,mod)
print(res)
x = raw_input().split()

y = map(int,x)

a = y[0]
b = y[1]

c = a*b
d = (a+b)*2

print c, d


### FIXED CODE ###

a,b=[int(x) for x in input().split()]
print(a*b,(a+b)*2)