Harryxun/stf_run huggingface dataset:
while 1:
	n=input()
	if n==0:break
	s=[map(int,raw_input().split()) for i in range(n)]
	sh=set([min(s[i]) for i in range(n)])
	tl=set([max([s[j][i] for j in range(n)]) for i in range(n)])
	print list(sh&tl)[0]
	

### FIXED CODE ###

while 1:
	n=input()
	if n==0:break
	s=[map(int,raw_input().split()) for i in range(n)]
	sh=set([min(s[i]) for i in range(n)])
	tl=set([max([s[j][i] for j in range(n)]) for i in range(n)])
	print list(sh&tl)[0] if len(sh&tl)>0 else 0
import sys
while 1:
	try:
		temp = input()
		if (temp==0):
			break
		N = temp
		a = []
		for i in range(N):
			a.append(map(int, raw_input().split())+[0])
		a.append([0 for i in range(0,temp+1)])	 
		for i in range(0,temp):#????????¢??????
			for j in range(0,temp):#????????¢??????
				a[i][temp] += a[i][j]
		for k in range(0,temp+1):#????????¢??????
			for l in range(0,temp):#????????¢??????
				a[temp][k] += a[l][k]
		for m in range(0,temp+1):
			for n in range(0,temp+1):
				sys.stdout.write(str(a[m][n]).rjust(5))
			print ""
	except(RuntimeError):
		pass

### FIXED CODE ###

import sys
try:
	while 1:
		temp = input()
		if (temp==0):
			break
		N = temp
		a = []
		for i in range(N):
			a.append(map(int, raw_input().split())+[0])
		a.append([0 for i in range(0,temp+1)])
		for i in range(0,temp):
			for j in range(0,temp):
				a[i][temp] += a[i][j]
		for k in range(0,temp+1):
			for l in range(0,temp):
				a[temp][k] += a[l][k]
		for m in range(0,temp+1):
			for n in range(0,temp+1):
				sys.stdout.write(str(a[m][n]).rjust(5))
			print ""
except(RuntimeError):
	pass
import math
r=int(input())
print("{0} {1}".format(r**2*math.pi,2*r*math.pi))

### FIXED CODE ###

import math
r=float(input())
print("{0} {1}".format(r**2*math.pi,2*r*math.pi))
X = int(raw_input())
A = int(raw_input())
B = int(raw_input())
X -= A
for X>B:
    X -= B
print X

### FIXED CODE ###

X = int(raw_input())
A = int(raw_input())
B = int(raw_input())
X -= A
while X >= B:
    X -= B
print X
a = input()
b = input()
if a == b:
  print("H")
else:
  print("D")

### FIXED CODE ###

a,b = input().split()
if a == b :
  print("H")
else:
  print("D")
S = int(input())
h = (S % 3600)
t = (S % 60)
s = (S - h - t)
print(h:t:s)

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
import bisect
while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = [input() for i in range(n)]
    ans = 0
    r.sort()
    for i in range(n):
        tmp = S - r[i] + 1
        if (tmp <= 0):
            ans += n - 1
        else:
            d = r[0:i] + r[i + 1:]
            left,right = 0,n
            while (right - left > 1):
                med = (right + left) / 2
                if (d[med] <=  tmp):
                    left = med
                else:
                    right = med
            ans += (len(d) - left) - 1
    print ans / 2

### FIXED CODE ###

import bisect
while True:
    n,S = map(int, raw_input().split())
    if n == 0 and S == 0:
        break
    r = [input() for i in range(n)]
    ans = 0
    r.sort()
    for i in range(n):
        tmp = S - r[i] + 1
        if (tmp <= 0):
            ans += n - 1
        else:
            index = bisect.bisect_left(r, tmp)
            if (index <= i):
                ans += n - index - 1
            else:
                ans += n - index
    print ans / 2
s = input()
t = input()
ans = 0
for i in range(3):
    if s[i] == t[i]:
        ans += 1
print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
x = 1
ans = 0
while x < b:
    x += a - 1
    ans += 1
print(ans)
from collections import counter
n = int(input())
a = [int(i) for i in input().split()]
output = 0
b = [abs(elem - i) for i, elem in enumerate(a, 1)]
c = counter(b)
d = c.most_common()

surume = 0
if len(d) == 1:
    surume = d[0][0]
else:
    if d[0][1] == d[1][1]:
        surume = 0
    else:
        surume = d[0][0]
e = [abs(abs(elem - i) - abs(surume)) for i, elem in enumerate(a, 1)]
print(sum(e))

### FIXED CODE ###

import math

n = int(input())
a = [int(i) for i in input().split()]
b = [elem - i for i, elem in enumerate(a, 1)]
b.sort()
center = b[math.floor(len(b) / 2)]
c = [abs(i - center) for i in b]
print(sum(c))
from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=t()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)

### FIXED CODE ###

from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
def p(a):print(" ".join(list(map(str,a))))
from collections import Counter

s=S()
t=S()
x=0
for i in range(len(s)):
    if s[i]!=t[i]:x+=1
print(x)
N,K=[int(s) for s in input().split()]
ls_p=[int(s) for s in input().split()]
ls_n=[]
X=0
for i in range(N):
  if ls_p[0]>=0 : break 
  else:
    X+=1
    ls_n.append(ls_p[0])
    ls_p.pop(0)
print(ls_n)
print(ls_p)
#ls_nにX個流れている
cand=[]
for i in range(min([X-1,K-2])):
  cand.append(-ls_n[-i-1]*2+ls_p[K-i-2])
  cand.append(-ls_n[-i-1]+ls_p[K-i-2]*2)
if N-X-1>=K-1:
  cand.append(ls_p[K-1])
if X>=K:
  cand.append(-ls_n[-K])
print(min(cand))
  

### FIXED CODE ###

N,K=[int(s) for s in input().split()]
ls=[int(s) for s in input().split()]
def length(i):
  if ls[i]>=0:
    return ls[K+i-1]
  elif ls[K+i-1]<=0:
    return -ls[i]
  else:
    return min([2*ls[K+i-1]-ls[i],ls[K+i-1]-2*ls[i]])
answer=[]
for i in range(N-K+1):
  answer.append(length(i))
  
print(min(answer))
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=sum(a)
c=sorted(a)
if c[n-m+1] >b//(4*m):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
b=sum(a)
a.sort(reverse=True)
if a[m-1]*4*m >=b:
  print("Yes")
else:
  print("No")
a,b = map(int,input().split(' ')
if a + b == 15:
    print('+')
elif a ＊ b == 15:
    print('＊')
else:
    print('x')

### FIXED CODE ###

a,b = map(int,input().split(' '))
if a + b == 15:
    print('+')
elif a * b == 15:
    print('*')
else:
    print('x')
#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    x, y, a, b, c = map(int, sys.stdin.readline().split())
    r = list(map(int, sys.stdin.readline().split()))
    g = list(map(int, sys.stdin.readline().split()))
    blind = list(map(int, sys.stdin.readline().split()))
    r.sort(reverse=True)
    g.sort(reverse=True)
    blind.sort(reverse=True)
    red_need = r[:x]
    green_need = g[:y]
    res = red_need + green_need
    res.sort()
    #print(res)
    for i in range(c):
        if blind[i] > res[i]:
            res[i] = blind[i]
    print(sum(res))


if __name__ == "__main__":
    # IOE()
    main()


### FIXED CODE ###

#author : dokueki

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    x, y, a, b, c = map(int, sys.stdin.readline().split())
    r = list(map(int, sys.stdin.readline().split()))
    g = list(map(int, sys.stdin.readline().split()))
    blind = list(map(int, sys.stdin.readline().split()))
    r.sort(reverse=True)
    g.sort(reverse=True)
    blind.sort(reverse=True)
    red_need = r[:x]
    green_need = g[:y]
    res = red_need + green_need
    res.sort()
    #print(res)
    for i in range(min(c,len(res))):
        if blind[i] > res[i]:
            res[i] = blind[i]
    print(sum(res))


if __name__ == "__main__":
    # IOE()
    main()
def sieve(m):
    N=range(1,m+2,2)
    r=int(m**.5)
    h=len(N)
    N[0]=0
    for i in range(h):
        x=N[i]
        if x>r: break
        if x and i+x<h: N[i+x:h:x]=[0]*((h-1-i-x)/x+1)
    return N
def f0056(n):
    x=0
    if n<4:x=0
    elif n==4:x=1
    elif n%2==1:
        if S[(n-2)/2]:
            x=1
    else:
        a=n/2
        for e in PRIMES:
            if e>a: break
            if S[(n-e)/2]:
                x+=1
    return x

S=sieve(50000)
PRIMES=filter(None,S)
for n in sys.stdin:
    n=int(n)
    if n==0: break
    print f0056(n)

### FIXED CODE ###

import sys
def sieve(m):
    N=range(1,m+2,2)
    r=int(m**.5)
    h=len(N)
    N[0]=0
    for i in range(h):
        x=N[i]
        if x>r: break
        if x and i+x<h: N[i+x:h:x]=[0]*((h-1-i-x)/x+1)
    return N
def f0056(n):
    x=0
    if n<4:x=0
    elif n==4:x=1
    elif n%2==1:
        if S[n/2-1]: x=1
    else:
        a=n/2
        for e in PRIMES:
            if e>a: break
            if S[(n-e)/2]: x+=1
    return x

S=sieve(50000)
PRIMES=filter(None,S)
for n in sys.stdin:
    n=int(n)
    if n==0: break
    print f0056(n)
a = int(input)
print(a + a**2 + a**3)

### FIXED CODE ###

def resolve():
    a = int(input())
    print(a + a**2 + a**3)

resolve()
N,K = map(int,input().split())
T = [[]*N for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
visited = [0]*N
ans = 1
def bfs(i,bb,b):
    global ans
    visited[i] = 1
    ans = (ans*(K-bb-b))%(10**9+7)
    cnt = 0
    for j in T[i]:
        if visited[j] == 1:
            continue
        bfs(j,b+cnt,1)
        cnt += 1
bfs(0,0,0)
print(ans)




### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

N,K = map(int,input().split())
T = [[]*N for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
visited = [0]*N
ans = 1
def bfs(i,bb,b):
    global ans
    visited[i] = 1
    ans = (ans*(K-bb-b))%(10**9+7)
    cnt = 0
    for j in T[i]:
        if visited[j] == 1:
            continue
        bfs(j,b+cnt,1)
        cnt += 1
bfs(0,0,0)
print(ans)
n = int(input())
ans = 0
for i in range(1,n + 1):
	if len(int(i)) % 2 == 1:
		ans += 1
print(ans) 

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1,n + 1):
	if len(str(i)) % 2 == 1:
		ans += 1
print(ans)
N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
dp=[1]*(N+2)
dp[1]=0 if a[0]==1 else 1
for i in a:
    dp[i]=0
for i in range(1,N):
    if dp[i+1]!=0:
        dp[i+1] = (dp[i]+dp[i-1]) % 1000000007
print(dp[N])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
def input():
    return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    a=[int(input()) for i in range(M)]
    dp=[1]*(N+1)
    if M!=0:
        dp[1]=0 if a[0]==1 else 1
        for i in a:
            dp[i]=0
    for i in range(1,N):
        if dp[i+1]!=0:
            dp[i+1] = (dp[i]+dp[i-1]) % 1000000007
    print(dp[N])


if __name__ == '__main__':
    main()
n,k = map(int,input().split())
 
print(k * (k-1)**(n-1))

### FIXED CODE ###

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

if a == b and a == c:
    print(1)
elif a == b and a != c:
    print(2)
elif a == c and a != b:
    print(2)
elif b == c and b != a:
    print(2)
else:
    print(3)
def main():
    inputs = input()

    roop_num = len(inputs)

    cnt = 0
    flag = False
    for start in range(roop_num-3):
        roop_num_end = roop_num - start
        ans_list = []
        ans_list = [int(inputs[start:end+start+4]) for end in range(roop_num_end-3) if int(inputs[start:end+start+4]) % 2019 == 0]

        cnt += len(ans_list)

    print(cnt)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    inputs = input().split(' ')
    sheep = int(inputs[0])
    wolf = int(inputs[1])

    if sheep > wolf:
        print('safe')

    else:
        print('unsafe')

if __name__ == '__main__':
    main()
# coding: utf-8

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

if c <= b:
  if b <= d:
    print(b - c)
  else:
    print(d - c)
else:
  print(0)


### FIXED CODE ###

# coding: utf-8

a = input()
if a[0] == a[-1]:
	print("Yes")
else:
	print("No")
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    idx=[[] for _ in range(max(A)+1)]
    for i,a in enumerate(A):
        idx[a].append(i)
    perm=[None]*n
    for I in idx:
        s=len(I)
        for i in range(s):
            if(i!=s-1): perm[I[i]]=(I[i+1]+1)%n
            else: perm[I[i]]=(I[0]+1)%n

    # perm の 先頭要素をサイクル分解する
    cycle=[0]
    v=perm[0]
    while(v):
        cycle.append(v)
        v=perm[v]

    # 元に戻るまで何周したか -> まずは k をこれで割る
    cycle.append(0)
    cnt=0
    for i in range(len(cycle)-1):
        if(cycle[i+1]<cycle[i] or cycle[i]+1==cycle[i+1]):
            cnt+=1
    k%=cnt

    # k が 0 になるまで消費する
    for i in range(len(cycle)-1):
        s=(cycle[i+1]<cycle[i] or cycle[i]+1==cycle[i+1])
        if(k-s<=0):
            break
        else:
            k-=s

    # cycle[i] 以降の数列について、実際に構成すればよい
    Q=[]
    cnt=[0]*(max(A)+1)
    for a in A[cycle[i]:]:
        if(cnt[a]==0):
            Q.append(a)
            cnt[a]=1
        else:
            while(Q[-1]!=a): Q.pop()
            Q.pop()
            cnt[a]=0
    print(*Q)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    A=list(map(int,input().split()))
    idx=[[] for _ in range(max(A)+1)]
    for i,a in enumerate(A):
        idx[a].append(i)

    # いくつ先に移動するかを求める
    next=[None]*n
    for I in idx:
        if(not I): continue
        s=len(I)
        I.append(I[0]+n)
        for i in range(s):
            next[I[i]]=I[i+1]-I[i]+1

    # doubling
    M=10**18 # n*k より大きな数で抑えておく
    nexts=[next]
    for _ in range(60):
        next=nexts[-1]
        nnext=[min(M,next[i]+next[(i+next[i])%n]) for i in range(n)]
        nexts.append(nnext)

    now=0
    for next in nexts[::-1]:
        if(now+next[now%n]<=n*k):
            now+=next[now%n]
    if(now==n*k):
        return

    # A[now%n:] に対してシミュレーションする
    ans=[]
    have=[0]*(max(A)+1)
    for a in A[now%n:]:
        if(not have[a]):
            ans.append(a)
            have[a]=1
        else:
            while(1):
                x=ans.pop()
                have[x]=0
                if(x==a): break

    print(*ans)
resolve()
n=int(input())
if n%2==1:
	print(0)
else:
	n2=n/2
	ans=0
	while n2>0:
		n2=n2//5
		ans+=n2
    print(int(ans))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    n=int(input())
    cnt=5
    ans=0
    if n%2==0:
        n=n//2
        while cnt<=n:
            ans+=n//cnt
            cnt*=5
    print(ans)                
    
if __name__ == '__main__':
    main()
d,n = map(int,input())

if d == 0:
  print(n)
else:
  print(100*d*n)

### FIXED CODE ###

d,n = map(int,input().split())
 
if d == 0:
    if n == 100:
        print(101)
    else: 
        print(n)
else:
    if n == 100:
        print(pow(100,d)*(n+1)) 
    else:
        print(pow(100,d)*n)
#coding:utf-8

if __name__ == "__main__":

    i = str(input())

    j = i.split('/')

    if int(j[0]) < 2019:
        print("Heisei")
    elif int(j[1].split('0')[1]) < 5:
        print("Heisei")
    else:
        print("TBD")

### FIXED CODE ###

#coding:utf-8

if __name__ == "__main__":

    i = str(input())

    j = i.split('/')

    if int(j[0]) < 2019:
        print("Heisei")
    elif int(j[1]) < 5:
        print("Heisei")
    else:
        print("TBD")
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

sumA = sum(A)
cnt_num = []
for i in range(10**5):
    cnt_num.append(A.count(i))

for i in range(Q):
    B, C = map(int, input().split())
    sumA += (C - B) * cnt_num[B]
    print(sumA)
    cnt_num[C] += cnt_num[B]
    cnt_num[B] = 0
    

### FIXED CODE ###

import numpy as np


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

sumA = sum(A)
cnt_num = np.zeros(10**5 + 1)

for i in A:
    cnt_num[i] += 1

for i in range(Q):
    B, C = map(int, input().split())
    sumA += (C - B) * cnt_num[B]
    print(int(sumA))
    cnt_num[C] += cnt_num[B]
    cnt_num[B] = 0
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

K = I()
S = LI2()
s = len(S)
mod = 10**9+7

dp1 = [0]*(K+s)
dp2 = [0]*(K+s)

for i in range(K+s):
    if i == s-1:
        dp1[i] = pow(26,i,mod)-1
    elif i == s:
        dp2[i] = pow(26,i,mod)-1
    else:
        dp1[i] = dp1[i-1]*26+dp2[i-1]*25
        dp1[i] %= mod
        dp2[i] = dp2[i-1]*26 + dp1[i-1]*25
        dp2[i] %= mod



print((dp1[K+s-1]*26 + (dp2[K+s-1]-dp1[K+s-1])*25) % mod)

### FIXED CODE ###

import sys

def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

K = I()
n = len(LS2())
mod = 10**9+7

# 完成図は、
# (S[0]以外からなる文字列)S[0](S[1]以外からなる文字列)S[1]…(S[n-1]以外からなる文字列)S[n-1](任意の文字列)
# この表記は一意
# 形式的冪級数で考えると,
# 求めたいものは (1-25x)^(-n)*(1-26x)^(-1) の x^K の係数であり、
# これは、(i+n-1)_C_(n-1)*25^i*26^(K-i) を i=0,…,K にわたって足し合わせたものである

C = [1]
for i in range(1,K+1):
    C.append((C[-1]*(i+n-1)*pow(i,mod-2,mod)) % mod)
# C[i] = (i+n-1)_C_(n-1)

ans = 0
for i in range(K+1):
    ans += C[i]*pow(25,i,mod)*pow(26,K-i,mod)
    ans %= mod

print(ans)
n = int(input())
ans = (10000 - n) % 1000

print(ans

### FIXED CODE ###

n = int(input())
ans = (10000 - n) % 1000

print(ans)
import sys
def input():
    return sys.stdin.readline()[:-1]
n,w=map(int,input().split())
dp=[[0]*(w+1) for _ in range(n)]
l=[0]*n
for i in range(n):
    l[i]=list(map(int,input().split()))
#print(l)
for i in range(w+1):
    if i>=l[0][0]:
        dp[0][i]=l[0][1]
for i in range(w+1):
    for j in range(n-1):
        if i<l[j+1][0]:
            dp[j+1][i]=dp[j][i]
        else:
            dp[j+1][i]=max(dp[j][i-l[j+1][0]]+l[j+1][1],dp[j][i])


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

### FIXED CODE ###

n,w=map(int,input().split())
l=[list(map(int, input().split())) for i in range(n)]
c=0
d=0
for i in range(n):
    c+=l[i][1];d+=l[i][0]
dp=[[0]*(c+1) for _ in range(n)]
for i in range(1,l[0][1]+1):
    dp[0][i]=l[0][0]
for i in range(l[0][1]+1,c+1):
    dp[0][i]=d
for i in range(1,n):
    for j in range(1,c+1):
        if j<=l[i][1]:
            dp[i][j]=min(dp[i-1][j],l[i][0])
        else:
            dp[i][j]=min(dp[i-1][j],dp[i-1][j-l[i][1]]+l[i][0])
#print(dp)
for i in range(c,0,-1):
    if dp[-1][i]<=w:
        print(i)
        break
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N,M = map(int,input().split())
fac = [1, 1]
inv = [0, 1]
finv = [1, 1]
MOD = 10**9+7
fac = [1, 1]
inv = [0, 1]
finv = [1, 1]
for i in range(2, M+1):
    fac.append(fac[-1] * i % MOD)
    inv.append(MOD - inv[MOD%i] * (MOD//i) % MOD)
    finv.append(finv[-1] * inv[-1] % MOD) 
def comb_mod(n, r, m):  #nCr mod m
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

def chofuku(n,r): # nHr mod MOD の計算
    return comb_mod(n+r-1,r)
 
def narabekae(n,r,m): #nPr mod m の計算
    return fac[n]*finv[n-r]%m
ans = 0
for i in range(1,N+1):
    if i % 2 == 1:
        flag = 1
    else:
        flag = -1
    s = flag*comb_mod(N,i,MOD)*nPr(M-i,N-i,MOD)
    ans += s
    if ans > MOD:
        ans %= MOD
ans1 = 1
for i in range(N):
    ans1 *= (M-i)
    ans1 %= MOD
ans2 = (ans1*ans1)%MOD
ans3 = (ans*nPr(M,N,MOD)) %MOD
print((ans2-ans3)%MOD)


### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N,M = map(int,input().split())
fac = [1, 1]
inv = [0, 1]
finv = [1, 1]
MOD = 10**9+7
for i in range(2, M+2):
    fac.append(fac[-1] * i % MOD)
    inv.append(MOD - inv[MOD%i] * (MOD//i) % MOD)
    finv.append(finv[-1] * inv[-1] % MOD) 
def comb_mod(n, r, m):  #nCr mod m
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m

def chofuku(n,r): # nHr mod MOD の計算
    return comb_mod(n+r-1,r)
 
def nPr(n,r,m): #nPr mod MOD の計算
    return fac[n]*finv[n-r]%m
ans = 0
for i in range(1,N+1):
    if i % 2 == 1:
        flag = 1
    else:
        flag = -1
    s = flag*comb_mod(N,i,MOD)*nPr(M-i,N-i,MOD)
    ans += s
    if ans > MOD:
        ans %= MOD
ans1 = 1
for i in range(N):
    ans1 *= (M-i)
    ans1 %= MOD
ans2 = (ans1*ans1)%MOD
ans3 = (ans*nPr(M,N,MOD)) %MOD
print((ans2-ans3)%MOD)
print(x**3)


### FIXED CODE ###

x=int(input())
result = x**3
print(result)
x, n = map(int, input().split())
num_list = list(map(int, input().split()))
dif = 101
o_list = []
num_list.sort(reverse=True)

if len(num_list) == 0:
    print(x)
    exit()

for i in range(1, max(num_list)):
    if i not in num_list:
        o_list.append(i)

o_list.sort(reverse=True)

for num in o_list:
    if abs(x - num) <= dif:
        # if x not in num_list:
        dif = abs(x -num)
        ans = num

print(ans)


### FIXED CODE ###

x, n = map(int, input().split())
num_list = list(map(int, input().split()))
dif = 100000
o_list = []

if len(num_list) == 0:
    print(x)
    exit()
#
# for i in range(1, max(num_list)):
#     if i not in num_list:
#         o_list.append(i)

for i in range(-1000, 1000):
    if i not in num_list:
        o_list.append(i)

o_list.sort(reverse=True)

for num in o_list:
    if abs(x - num) <= dif:
        # if x not in num_list:
        dif = abs(x -num)
        ans = num

print(ans)
def calc(n):
    damage = (b * n)
    d = [max(dd - damage, 0) for dd in h]
    a_num = 0
    for i in range(len(d)):
        a_num += max(0, 1 + (d[i]-1) // (a - b))
    if a_num <= n:
        return True
    return False

n, a, b = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))
ans = 0
h.sort()

left = 0
right = (h[-1] + 1) // (b)

while (right - left) > 1:
    middle = (left + right) // 2
    if calc(middle):
        right = middle
    else:
        left = middle
if calc(middle):
    print(middle)
else:
    print(middle + 1)

### FIXED CODE ###

def calc(n):
    damage = (b * n)
    d = [max(dd - damage, 0) for dd in h]
    a_num = 0
    for i in range(len(d)):
        a_num += max(0, 1 + (d[i]-1) // (a - b))
    if a_num <= n:
        return True
    return False

n, a, b = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))
ans = 0
h.sort()

left = 0
right = 10000000000

while (right - left) > 1:
    middle = (left + right) // 2
    if calc(middle):
        right = middle
    else:
        left = middle
print(right)
N,K,M = map(int,input().split())

A = []

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

S = sum(A)
Score = M * N

n = Score - S

if n >=0 and n < 100:
    print(n)
elif n >= 100:
    print('-1')
else:
    print(0)

### FIXED CODE ###

x = input()
l = [chr(i) for i in range(97, 97+26)]

for i in range(26):
    if l[i]== x:
        k = i
        
print(l[k+1])