Harryxun/stf_run huggingface dataset:
N = int(input())
C = [int(input()) for _ in range(N)]
subC = [-2] * (2 * 10 ** 5)
cntC = [-1]*N
for num, i in enumerate(C):
    cntC[num] = subC[i]+1
    subC[i] = num

# print(cntC)

dp = [0] * (N + 10)
dp[0] = 1
for i in range(N):
    if cntC[i] == -1 or cntC[i] == i:
        dp[i + 1] = dp[i]
    else:
        dp[i + 1] = dp[i] + dp[cntC[i]]


print(dp[N])

### FIXED CODE ###

N = int(input())
C = [int(input()) for _ in range(N)]
MOD = 10**9 + 7
subC = [-2] * (2 * 10 ** 5 + 10)
cntC = [-1]*N
for num, i in enumerate(C):
    cntC[num] = subC[i]+1
    subC[i] = num

# print(cntC)

dp = [0] * (N + 10)
dp[0] = 1
for i in range(N):
    if cntC[i] < 0 or cntC[i] == i:
        dp[i + 1] = dp[i] % MOD
    else:
        dp[i + 1] = (dp[i] + dp[cntC[i]]) % MOD


print(dp[N])
a = raw_input().replace("egg","0").replace("chicken","1")
for i in range(len(a)-1):
	if a[i] == a[i+1]:
		if len(a[:i+1]) >= len(a[i+1:]):
			ans = a[:i+1][-1]
			break
		else:
			ans = a[i+1:][-1]
			break
print "egg" if ans == "0" else "chicken"

### FIXED CODE ###

a = raw_input().replace("egg","0").replace("chicken","1")
for i in range(len(a)-2,-1,-1):
	if a[i] == a[i+1]: a = a[:i+1] + " " + a[i+1:]
a = sorted(a.split(), key = lambda x:len(x), reverse = True)
print "egg" if a[0][-1] == "0" else "chicken"
import sys
count = 1
while True:
  x,y = sys.stdin.readline().split().strip()
  if x == 0 and y == 0:
    break
    if x < y:
      result = (x,y)
    else:
      result = (y,x)
  print(result)
  count = count + 1

### FIXED CODE ###

import sys
while True:
    a,b=map(int,sys.stdin.readline().split())
    if a==0 and b==0:
        break
    if a<b:print(a,b)
    else:print(b,a)
N,D = map(int(input().split()))
sum = 1
cnt = 0
while sum > N:
  sum += 2D
  cnt += 1

print(cnt)

### FIXED CODE ###

N,D = map(int,input().split())
S = 0
cnt = 0
while S < N:
  S += 1+2*D
  cnt +=1
print(cnt)
n=int(input())
print("Hello World" if n == 2 else int(input())+int(input()))

### FIXED CODE ###

n=int(input())
print("Hello World" if n != 2 else int(input())+int(input()))
INF = 10 ** 10
n, t = map(int, raw_input().split())

stores = []
for i in xrange(n):
    a, b = map(int, raw_input().split())
    stores.append((a, b))

def mycmp(s1, s2):
    a1, b1 = s1
    a2, b2 = s2
    v1 = a2 + a2 * b1
    v2 = a1 + a1 * b2
    return cmp(v1, v2)

stores.sort(cmp=mycmp)

dp = [ [INF for i in xrange(30)] for j in xrange(2) ]
dp[0][0] = 0

p = 0
for i in xrange(n):
    q = p ^ 1
    dp[q] = [INF for i in xrange(30)]

    a, b = stores[i]
    for j in xrange(30):
        dp[q][j] = dp[p][j]
        if dp[p][j] == -INF:
            continue
        if j + 1 < 30:
            t = dp[p][j] + 1
            dp[q][j + 1] = min(dp[q][j + 1], dp[p][j] + 1 + a * t + b)
            if dp[q][j + 1] <= t:
                res = j + 1
    p = q
print res



### FIXED CODE ###

INF = 10 ** 10
N = 100
n, T = map(int, raw_input().split())

stores = []
zs = []
for i in xrange(n):
    a, b = map(int, raw_input().split())
    if a == 0:
        zs.append(b)
    else:
        stores.append((a, b))

def mycmp(s1, s2):
    a1, b1 = s1
    a2, b2 = s2
    v1 = a2 + a2 * b1
    v2 = a1 + a1 * b2
    return cmp(v1, v2)

stores.sort(cmp=mycmp)
stores.append((INF, INF))
zs.sort()

m = len(zs)

for i in xrange(1, m):
    zs[i] += zs[i - 1]

dp = [ [INF for i in xrange(N)] for j in xrange(2) ]
dp[0][0] = 0
res = 0

n = len(stores)

p = 0
for i in xrange(n):
    q = p ^ 1
    dp[q] = [INF for j in xrange(N)]

    a, b = stores[i]
    for j in xrange(N):
        dp[q][j] = min(dp[q][j], dp[p][j])
        if dp[p][j] == -INF:
            continue
        if j + 1 < N:
            t = dp[p][j] + 1
            dp[q][j + 1] = min(dp[q][j + 1], dp[p][j] + 1 + a * t + b)
            if dp[q][j + 1] <= T:
                res = max(res, j + 1)
    for j in xrange(N):
        if dp[q][j] > T:
            continue
        rem = T - dp[q][j] - 1
        l, r = 0, m - 1
        while l <= r:
            mid = (l + r) / 2
            if zs[mid] + mid <= rem:
                res = max(res, j + mid + 1)
                l = mid + 1
            else:
                r = mid - 1
    p = q
print res
import numpy as np
from fractions import gcd

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

p=10**9+7
n = 10 ** 4  # N は必要分だけ用意する
#fact = [1, 1]  # fact[n] = (n! mod p)
#factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用 逆元

for i in range(2, n + 1):
    #fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    #factinv.append((factinv[-1] * inv[-1]) % p)
#a//gcd(a,b)*b

def lcm(a,b):
    g=gcd(a,b)
    #return ((a*b)*pow(g,p-2,p))%p
    return a//gcd(a,b)*b

LCM=1
for x in A:
    LCM=lcm(LCM,x)



#print(LCM)
ans=0
LCM%=p
for i in range(N):
    ans+=(LCM*inv[A[i]])%p
    #ans+=(LCM*pow(A[i],p-2,p))%p
    ans%=p
print(ans)

### FIXED CODE ###


#かけて最小公倍数になる　そのために必要な数がB
from fractions import gcd
N=int(input())
if N==1:
  print(1)
  exit()

mod=10**9+7
A=list(map(int, input().split()))
def lcm(a,b):
  return a//gcd(a,b)*b

if N==2:
  LCM=lcm(A[0],A[1])
  ans=((LCM//A[0])+(LCM//A[1]))%mod
  print(ans)
  exit()

LCM=1
#LCM%=mod
for a in A:
  LCM=lcm(LCM, a)
  #LCM%=mod
  
#print(LCM)
ans=0
for a in A:
  ans+=LCM//a
  #ans%=mod

print(int(ans%mod))
S = input()
T = input()
D = []
for i in range(len(S) - len(T)):
    SS = S[i:i+len(T)]
    dif = 0
    for j in range(len(T)):
        if T[j] != SS[j]:
            dif += 1
    D += [dif]
            
print(min(D))

### FIXED CODE ###

S = input()
T = input()
D = []
for i in range(len(S) - len(T) + 1):
    SS = S[i:i+len(T)]
    dif = 0
    for j in range(len(T)):
        if T[j] != SS[j]:
            dif += 1
    D += [dif]
            
print(min(D))
n = int(input())
s = input()
if n % 2 == 1:
  print("No")

if s[0:n/2] == s[n/2:]:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

r = int(input() )
print(r*r)
N, M = map(int, input().split())
S, C = [], []
for _ in range(M):
    s, c = map(int, input().split())
    """if s == 1 and c == 0:
        print(-1)
        exit()"""
    if s in S:
        if C[S.index(s)] != c:
            print(-1)
            exit()
        else:
            continue
    S.append(s)
    C.append(c)

z = zip(S, C)
z = sorted(z)
S, C = zip(*z)

ans = [-1] * N
for i in range(len(S)):
    ans[S[i]-1] = C[i]

if ans[0] == 0:
    print(-1)
    exit()

if ans[0] == -1 and ans[1] == 0:
    print(-1)
    exit()

if ans[0] == -1 and ans[1] == -1 and ans[2] == -1:
    print(-1)
    exit()
if ans[0] == -1 and ans[1] == -1:
    print(ans[2])
    exit()
if ans[0] == -1:
    print(str(ans[1]) + str(max(0, ans[2])))
    exit()
print(str(ans[0]) + str(max(0, ans[1])) + str(max(0, ans[2])))

### FIXED CODE ###

N, M = map(int, input().split())
S, C = [], []
for _ in range(M):
    s, c = map(int, input().split())
    s -= 1
    if s in S:
        if C[S.index(s)] != c:
            print(-1)
            exit()
        else:
            continue
    S.append(s)
    C.append(c)

if len(S) == 0:
    if N == 1:
        print(0)
    elif N == 2:
        print(10)
    else:
        print(100)
    exit()

ans = [-1] * N
for i in range(len(S)):
    ans[S[i]] = C[i]

if N == 1:
    if ans[0] == 0:
        print(0)
        exit()

if ans[0] == -1:
    ans[0] = 1
elif ans[0] == 0:
    print(-1)
    exit()

ans = [a if a != -1 else 0 for a in ans]
print(''.join(list(map(str, ans))))
a, b = gets.split.map(&:to_i)
printf "%d %d %.5f", a / b, a % b, a.to_f / b


### FIXED CODE ###

a, b = map(int, input().split())
d = a // b
r = a % b
f = a / b
print(d, r, "{:.5f}".format(f))
n , m = map(int, raw_input().split())

tmp = m - (2 * n)
ans = 0
if tmp < 0:
        tmp = m - 2 * (n - tmp)
        if tmp >= 0:
                n -= n - tmp
                break

m = tmp

ans += n
ans += tmp / 4

print ans

### FIXED CODE ###

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

tmp = m - (2 * n)
if tmp < 0:
        ans = m / 2
else:
        ans = 0
        ans += n
        ans += tmp / 4

print ans
import heapq

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

q = []
for i in range(M):
    # 最も大きい値を取り出して1/2したいので、ここで反転させておき、最終的に足す時に戻す
    heapq.heappush(q, -a[i])
for i in range(M):
    l = heapq.heappop(q)
    heapq.heappush(q, -(-l//2))
print(-sum(q))

### FIXED CODE ###

import heapq

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

q = []
for i in range(N):
    # 最も大きい値を取り出して1/2したいので、ここで反転させておき、最終的に足す時に戻す
    heapq.heappush(q, -a[i])
for i in range(M):
    l = heapq.heappop(q)
    heapq.heappush(q, -(-l//2))
print(-sum(q))
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
elif r == 3:
    print(999)
else:
    X = [0] * 10**9

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A*2-1,A+B,B*2-1))
n=int(input())
A=[]
X=[]
Y=[]
for i in range(n):
  a=int(input())
  A.append(a)
  x=[]
  y=[]
  for j in range(a):
    x1,y1=[int(s) for s in input().split()]
    x.append(x1)
    y.append(y1)
  X.append(x)
  Y.append(y)
  
c=0
#for i in range(n):
 # l=[1]*n
  #for j in range(i, n-i):
   # if l[j]==0:continue
    #for k in range(A[j]):
    　#　l[X[j][k]] *= Y[j][k]
  #if c<l.count(1):
   # c=l.count(1) 
  
        
  
print(c)  
  
  
  
  
  
  
  
  
  
  
  
  
  

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
a, b, c = map(int, input().split())

print(a+b+c)

### FIXED CODE ###

print(input().count("1"))
from __future__ import print_function
from collections import deque
from bisect import bisect_left as bl
input = raw_input
range = xrange

def goto(fr, to):
    i = bl(occ[to], fr+1)
    if i == len(occ[to]): return n+1
    return occ[to][i]

s = [-1]+[ord(c)-97 for c in input()]
n = len(s)-1
occ = [[] for i in range(26)]
for i in range(1, n+1):
    occ[s[i]].append(i)
visit = [None]*(n+2)
visit[0] = (-1, -1) # letter, lastindex
Q = deque()
Q.append(0)

while len(Q):
    p = Q.popleft()
    if p == n+1: break
    for q in range(26):
        qi = goto(p, q)
        if visit[qi]: continue
        visit[qi] = (q, p)
        Q.append(qi)
stack = []
i = n+1
while visit[i][0] != -1:
    stack.append(visit[i][0])
    i = visit[i][1]

for i in reversed(stack):
    print(chr(97+i), end='')

### FIXED CODE ###

from collections import Counter
n = int(input())
C = Counter(map(int,input().split()))
quad = [i for i in C if C[i] >= 4]
if quad: maxa = max(quad)**2
else: maxa = 0

twice = [i for i in C if C[i] >= 2]
twice.sort()
if len(twice) >= 2: maxa = max(maxa, twice[-1]*twice[-2])
print(maxa)
from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = pos.pop()
                y = pos.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg == 0):
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = neg.pop()
                y = neg.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg) == 0:
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()
N,W=map(int,input().split())

items=[]

for i in range(N):
    items.append(list(map(int,input().split())))
    
dp = [[0 for i in range(10001)] for j in range(100)]

for i in range(N):
    dp[i][0]=0
    
for i in range(N):
    for w in range(W+1):
        if w>=items[i][1]:
            dp[i+1][w]=max(dp[i][w-items[i][1]]+items[i][0],dp[i][w])
        else:
            dp[i+1][w]=dp[i][w]
        


print(dp[N][W])


### FIXED CODE ###

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

items=[]

for i in range(N):
    items.append(list(map(int,input().split())))
    
dp = [[0 for i in range(10001)] for j in range(110)]

for i in range(N):
    dp[i][0]=0
    
for i in range(N):
    for w in range(W+1):
        if w>=items[i][1]:
            dp[i+1][w]=max(dp[i][w-items[i][1]]+items[i][0],dp[i][w])
        else:
            dp[i+1][w]=dp[i][w]
        


print(dp[N][W])
N,M,Q=map(int,input().split())
que=[tuple(map(int,input().split())) for _ in range(Q)]
task=[]
sta=[str(i) for i in range(1,M+1)]
while sta:
    s=sta.pop()
    if len(s)==N: task.append(s)
    else:
        for d in range(int(s[-1]),M+1):
            sta.append(s+str(d))
ans=0
for s in task:
    A=[int(i) for i in s]
    tmp=0
    for a,b,c,d in que:
        if A[b-1]-A[a-1]==c: tmp+=d
    ans=max(ans,tmp)
print(ans)

### FIXED CODE ###

N,M,Q=map(int,input().split())
que=[tuple(map(int,input().split())) for _ in range(Q)]
task=[]
sta=[[i] for i in range(1,M+1)]
while sta:
    s=sta.pop()
    if len(s)==N: task.append(s)
    else:
        for d in range(int(s[-1]),M+1):
            sta.append(s+[d])
ans=0
for s in task:
    tmp=0
    for a,b,c,d in que:
        if s[b-1]-s[a-1]==c: tmp+=d
    ans=max(ans,tmp)
print(ans)
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

I = np.array(read().split(), np.int64)
X = I[::2]
H = I[1::2]

sort_ind = np.argsort(X)
X = X[sort_ind]
H = H[sort_ind]

atack = np.zeros(N+1)
cover = np.searchsorted(X, X + (2 * D), side = 'right')

ans = 0
cnt = 0
for i in range(N):
	cnt += atack[i]
	H[i] -= cnt
	if H[i] > 0:
		tmp = -(-H[i]//A)
		ans += tmp
		cnt += tmp * A
		atack[cover[i]] -= tmp * A

print(ans)

### FIXED CODE ###

import numpy as np
import sys
N, D, A = map(int, input().split())
L = 2 * D
I = np.array(sys.stdin.read().split(), np.int64)
X = I[::2]
H = I[1::2]
sort_ind = np.argsort(X)
X = X[sort_ind]
H = H[sort_ind]
S = np.zeros(N+1, np.int64)
ind = np.searchsorted(X,X+L+1,side = 'left')

atack = 0
ans = 0
for i in range(N):
	atack += S[i]
	H[i] -= atack
	if H[i] > 0:
		atack_cnt = -(-H[i]//A)
		ans += atack_cnt
		tmp = atack_cnt * A
		S[i+1] += tmp
		S[ind[i]] -= tmp

print(ans)
N,K=map(int,input().split())
S=input()

q=[0]
for i in range(1,N):
    if S[i]!=S[i-1]:
        q.append(i)

answers=[]

for p in q[:(2*K+1)]:
    if S[p]==1:
        answers.append(q[min(2*K+1,N)]-p+1)
    else:
        answers.append(q[min(2*K,N)]-p+1)
        
print(max(answers))

### FIXED CODE ###

N,K=map(int,input().split())
S=input()+'E'

# Initial values
ans=1
l=0
r=0
edge=[]

# 立っているグループのカウント
# 最初の文字が0なら1
if S[l]=='0':
    count=1
else:
    count=0    

# ｒがNまでループ
while(r < N-1):
    r+=1
    #　もし1=>0の境目だと、countを追加
    if ( S[r-1]=='1') & (S[r]=='0'):
        count+=1

    #　countがKを超すとlのループに入る(Break)
    while(count>K):
        l+=1
        # lを更新したとき0=>1の境目だと、l~r間の0グループが減るので、countを減らす
        if (S[l-1]=='0') & (S[l]=='1'):
            count-=1
        #lがrを追い越さないように
        if l==r:
            r+=1
        #print(r,l,count,ans)

    #何事もなく 進んだ場合は答えの更新
    ans=max(ans,r-l+1)
    #print(r,l,count,ans) 

print(ans)
N,M = map(int,input().split())

sclist = []
for count in range(M):
    d = list(map(int,input().split()))
    sclist.append(d)

flag = False;
for count in range(10**(N-1),10**(N)):
    flag = False
    for count1 in range(M):
        s = sclist[count1][0]
        c = sclist[count1][1]
        if str(count)[s-1] == str(c):
            flag = True
        else:
            flag = False
            break
    if flag == True:
        print(count)
        break

if flag == False and M != 0:
    print(-1)
elif flag == False and M == 0:
    print((N-1)** 10)




### FIXED CODE ###

N= int(input())

count = 0

if N % 2 == 0:
    print(int(N/2))
else:
    print(int(N/2) + 1)
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b
from collections import deque

n, m = getMN()
class vertex():
    def __init__(self):
        self.number = 0
        self.dst = 0

parents = [[] for i in range(n+1)]
childs = [[] for i in range(n+1)]

k = m-1+n
for i in range(k):
    p1,p2 = getMN()
    parents[p2].append(p1)
    childs[p1].append(p2)
#vtxs = [vertex() for i in range(n+2)]
dst = [0 for i in range(n+1)]


d = deque()
for i ,x in enumerate(parents[1:]):
    if not x:
        n_root = i+1
        break

def bfs(n_cur):
    #print(([v.dst for v in vtxs]))
    #c is pure integer
    #print("n_cur = {}".format(n_cur))
    for c in childs[n_cur]:
        d.append(c)
        #print("c = {}".format(c))
        dst[c] = max(dst[c], dst[n_cur]+1)
    #print("d = {}".format(d))
    while(d):
        bfs(d.popleft())

bfs(n_root)



for plist in parents[1:]:
    if plist:
        cur = -1
        for p in plist:
            if dst[p] > cur:
                cur = dst[p]
                ans = p
        print(ans)
    else:
        print(0)


### FIXED CODE ###

def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))

n,m = getNM()
children = [[] for i in range(n+2)]
n_in = [0] * (n+1)
par_origin = [0] * (n+1)

#入力の処理
for i in range(n+m-1):
    a,b = getNM()
    children[a].append(b)
    n_in[b] += 1

#根を見つける
for i in range(1,n+m-1):
    if n_in[i]:
        pass
    else:
        root = i
        break

#次数を減らしながら探索
import queue
def bfs(root):
    q = queue.Queue()
    q.put(root)
    while(True):
        try:
            cur = q.get(block=False)
        except:
            break
        for c in children[cur]:
            if n_in[c] == 1:
                par_origin[c] = cur
                q.put(c)
            else:
                n_in[c] -= 1

bfs(root)
for i in range(1, n+1):
    print(par_origin[i])
# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""

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

def calc(n):
    if n==1:
        return 1.0
    return calc(n-1)+(1.0/n)

ev = 0
for i in range(1,N):
    ev += (X[i]-X[i-1])*calc(i)
    if ev>=(10**9+7):
        ev = ev%(10**9+7)

print(int(ev*math.factorial(N-1)%(10**9+7)))

### FIXED CODE ###

# -*- coding: utf-8 -*-

mod = 10**9 +7
N = int(input())
X = list(map(int, input().split()))

factorial=[1]
for i in range(1,N):
    factorial.append(factorial[-1] *i %mod)

ans=0
for i in range(1,N):
    ans = (ans*i + (X[-1]-X[i-1])*factorial[i-1]) %mod

print(ans)
n=int(input())
h=[int(i) for i in input().split()]

def ml(i,count,maxmove):
  if i==n-1:
    if count>maxmove: maxmove=count
    return maxmove
  if h[i]>=h[i+1]:
    count+=1
    return ml(i+1,count,maxmove)
  if count>maxmove:
    maxmove=count
  return ml(i+1,0,maxmove)
  
print(ml(0,0,0))

### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]

count=0
ans=0

for i in range(n-1):
  if h[i]>=h[i+1]:
    count+=1
  else:
    count=0
  ans=max(count, ans)
  
print(ans)
import math

#入力
a,b,x = map(int, input().split())

c = (2*x)/(a*b)
if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    d = a*b/(b-c)
    print(90-math.degrees(math.atan(d/b)))
else:
    print(90 - math.degrees(math.atan(c/b)))


### FIXED CODE ###

import math

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    if b == c:
        print(0)
    else:
        d = a*b/(b-c)
        print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))