Harryxun/stf_run huggingface dataset:
n=int(input())
l=[[*map(int,input().split())] for i in range(n)]
ans=0
prev=""
for i in range(n):
    a,b,c=l[i]
    if(a>b and a>c):
        if(prev!='a'):
            ans+=a
            prev='a'
        else:
            x=[a,b,c]
            x.sort()
            y=l[i-1].copy()
            y.sort()
            if(l[i-1][0]+x[1]>=y[1]+x[-1]):
                ans+=x[1]
                if(x[1]==a):
                    prev='a'
                elif(x[1]==b):
                    prev='b'
                else:
                    prev='c'
            else:
                ans-=y[-1]
                ans+=(y[1]+a)
                prev='a'
    elif(b>a and b>c):
        if(prev!='b'):
            prev='b'
            ans+=b
        else:
            x=[a,b,c]
            x.sort()
            y=l[i-1].copy()
            y.sort()
            if(l[i-1][1]+x[1]>=y[1]+x[-1]):
                ans+=x[1]
                if(x[1]==a):
                    prev='a'
                elif(x[1]==b):
                    prev='b'
                else:
                    prev='c'
            else:
                ans-=y[-1]
                ans+=(y[1]+b)
                prev='b'
    elif(c>a and c>b):
        if(prev!='c'):
            ans+=c
            prev='c'
        else:
            x=[a,b,c]
            x.sort()
            y=l[i-1].copy()
            y.sort()
            if(l[i-1][2]+x[1]>=y[1]+x[-1]):
                ans+=x[1]
                if(x[1]==a):
                    prev='a'
                elif(x[1]==b):
                    prev='b'
                else:
                    prev='c'
            else:
                ans-=y[-1]
                ans+=(y[1]+c)
                prev='c'
    else:
        ans+=max(l[i])
        z=max(l[i])
        if(z==a and prev!='a'):
            prev='a'
        elif(z==b and prev!='b'):
            prev='b'
        else:
            prev='c'
    #print(ans,prev)
print(ans)

### FIXED CODE ###

n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
ans=[[0,0,0] for i in range(n+1)]
for i in range(n):
    ans[i+1][0]=max(ans[i][1]+l[i][0],ans[i][2]+l[i][0])
    ans[i+1][1]=max(ans[i][2]+l[i][1],ans[i][0]+l[i][1])
    ans[i+1][2]=max(ans[i][0]+l[i][2],ans[i][1]+l[i][2])
print(max(ans[-1]))
a = list(map(int,input().split()))

if a[0] == 1:
    print("Hello World")
else:
    print(a[1] + a[2])

### FIXED CODE ###

N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
N = int(input())
g = [[] for x in range(N+1)]
for i in range(N - 1):
  (a, b, c) = map(int, input().split())
  g[a].append([b, c])
  g[b].append([a, c])

(Q, K) = map(int, input().split())
d = [-1] * (N+1)
d[K] = 0

def fill(i):
  for v in g[i]:
    if(d[v[0]] == -1):
      d[v[0]] = d[i] + v[1]
      fill(v[0])
  return
  
fill(K)

q = list()
for i in range(Q):
  q.append(input())
for i in range(Q):
  (x, y) = map(int, q[i].split())
  print(d[x] + d[y])


### FIXED CODE ###

from collections import deque
N = int(input())
g = [[] for x in range(N+1)]
for i in range(N - 1):
  (a, b, c) = map(int, input().split())
  g[a].append([b, c])
  g[b].append([a, c])

(Q, K) = map(int, input().split())
d = [-1] * (N+1)
d[K] = 0
r = deque()

r.append(K)
while len(r) > 0:
  i = r.popleft()
  for v in g[i]:
    if(d[v[0]] == -1):
      d[v[0]] = d[i] + v[1]
      r.append(v[0])

q = list()
for i in range(Q):
  q.append(input())
for i in range(Q):
  (x, y) = map(int, q[i].split())
  print(d[x] + d[y])
x**3


### FIXED CODE ###

x=int(input())
print(x**3)
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
while True:
    if len(a) and len(b):
        if a[0] < b[0] and k >= a[0]:
            k-=a[0]
            del a[0]
            ans+=1
        elif a[0] >= b[0] and k >= b[0]:
            k-=b[0]
            del b[0]
            ans+=1
        else:
            print(ans)
            exit()
    elif len(a)==0 and k >= b[0]:
        k-=b[0]
        del b[0]
        ans+=1
    elif len(b)==0 and a[0] <= k:
        k-=a[0]
        del a[0]
        ans+=1
    else:
        print(ans)
        exit()

### FIXED CODE ###

import numpy as np
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
a=np.cumsum(A)
b=np.cumsum(B)
a=np.insert(a,0,0)
b=np.insert(b,0,0)
j=m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k-a[i]:
        j-=1
    ans=max(ans,i+j)
print(ans)
x, y, A, B, C = map(int, input().split(' '))

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

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

a = a[:x]
b = b[:y]

a_index = -1
b_index = -1

a_sum = sum(a)
b_sum = sum(b)

a_target = a[a_index]
b_target = b[b_index]

for i in c:
  if a_target > i and b_target > i:
    # もうりんごの更新はされない
    break
    
  if a_target > b_target:
    b_index -= 1
    b_sum -= b_target
    b_target = b[b_index]
    b_sum += i
  else:
    a_index -= 1
    a_sum -= a_target
    a_target = a[a_index]
    a_sum += i
    
print(a_sum + b_sum)

### FIXED CODE ###

x, y, A, B, C = map(int, input().split(' '))

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

a.sort(reverse=True)
b.sort(reverse=True)

a = a[:x]
b = b[:y]

d = a + b + c
d.sort(reverse=True)

print(sum(d[:x+y]))
import numpy as np
H,W,D = map(int,input().split())
a = [input().split() for l in range(H)]
Q = int(input())
b = [input().split() for l in range(Q)]
a = np.array(a)
b = np.array(b)
a = np.int64(a)
b = np.int64(b)
ans = []
memo = [[-1]*302 for i in range(302)]
for i in range(Q):
  syo = b[i,0]
  go = b[i,1]
  if memo[syo][go] != -1:
    ans.append(memo[syo][go])
    continue
  syouhi = 0
  while syo != go:
    c = np.where(a == syo)
    syo += D
    d = np.where(a == syo)
    syouhi += abs(c[0][0] - d[0][0]) + abs(c[1][0] - d[1][0])
  ans.append(syouhi)
  memo[syo][go] = syouhi
for i in range(Q):
  print(ans[i])

### FIXED CODE ###

import numpy as np
H,W,D = map(int,input().split())
a = [input().split() for l in range(H)]
basyo = [[0,0] for i in range(H*W)]
for i in range(W):
  for j in range(H):
    basyo[int(a[j][i])-1] = [j,i]
Q = int(input())
b = [input().split() for l in range(Q)]
ans = []
memo = [0] * (H*W+1)
for i in range(D):
  while i < H*W:
    i += D
    if i >= H*W:
      break
    memo[i] = memo[i-D]  + abs(basyo[i][0] - basyo[i-D][0]) + abs(basyo[i-D][1] - basyo[i][1])
b = np.array(b)
b = np.int64(b)
for i in range(Q):
  syo = b[i,0]
  go = b[i,1]
  print(memo[go-1] - memo[syo-1])
a,b = map(int,input().split())

c = input().split()

while 1:
    f = 1
    s = str(c)
    for i in c:
        if i in s: f = 0
    if f : break
    c += 1
print(c)

### FIXED CODE ###

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

c = input().split()

while 1:
    f = 1
    s = str(a)
    for i in c:
        if i in s: f = 0
    if f : break
    a += 1
print(a)
n, m = map(int, input().split())
a = list(map(int, input().split()))
from math import gcd

for i in range(n):
    a[i] = a[i]//2
    
# print(a)
def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n/=2
    return ret


flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        continue
    else:
        flag = False
        print(0)
        exit()

a = [a[i]//t for i in range(n)]


gcd_a = a[0]
for i in range(1,n):
    p = max(gcd_a, a[i])
    q = min(gcd_a, a[i])
    gcd_a = gcd_a*a[i]//gcd(p, q)
# print("gcd_a", gcd_a)

if flag:
    if (m//gcd_a)%2 == 0:
        print(int((m//gcd_a)//2))
    else:
        print(int((m//gcd_a+1)//2))

else:
    print(0)


### FIXED CODE ###

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

for i in range(n):
    a[i] = a[i]//2
    
# print(a)
def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n//=2
    return ret


flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        # print(calc(a[i]),calc(a[i+1]))
        continue
    else:
        flag = False
        break


def gcd(a, b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)



if flag:
    lcm = 1
    for i in range(n):
        p = max(lcm, a[i])
        q = min(lcm, a[i])
        lcm = lcm*a[i]//gcd(p, q)
        # print(lcm)
    if (m//lcm)%2 == 0:
        print(int((m//lcm)//2))
    else:
        print(int((m//lcm+1)//2))

else:
    print(0)
import math
def main():
  N = int input()
  if (N < 1 || N > 50000):
    print(":(")
    return
  estimatedX1 = math.floor(N / 1.08)
  estimatedX2 = math.ceil(N / 1.08)
  
  if (round.floor(estimatedX1 * 1.08) == N):
    print(round.floor(estimatedX1 * 1.08))
  elif (round.floor(estimatedX2 * 1.08) == N):
    print(round.floor(estimatedX2 * 1.08))
  else:
    print(":(")

main()

### FIXED CODE ###

import math
def main():
  N = int(input())
  if (N < 1 or N > 50000):
    print(":(")

  estimatedX1 = math.floor(N / 1.08)
  estimatedX2 = math.ceil(N / 1.08)
  
  if (math.floor(estimatedX1 * 1.08) == N):
    print(math.floor(estimatedX1))
  elif (math.floor(estimatedX2 * 1.08) == N):
    print(math.floor(estimatedX2))
  else:
    print(":(")

main()
k = int(input().replace(' ', '')) ** (1 / 2)
print('Yes' if int(k) ** int(k) == k ** k else 'No')

### FIXED CODE ###

k = int(input().replace(' ', '')) ** (1 / 2)
print('Yes' if int(k) == k else 'No')
a = map(int,input().split())
for i in range(2,10,1):
  if a % i == 0 and a/i < 10:
    print('Yes')
	return 0
print('No)

### FIXED CODE ###

a = int(input())
for i in range(1,10,1):
  if a % i == 0 and a/i < 10:
    print('Yes')
    exit(0)
print('No')
# 09-Computation-Min_Max_and_Sum.py

# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????

# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai ????????????????????§?????????????????????
# Output
# ????°????????????§??????????¨????????????????????????§????????????????????????????????????

# Constraints
# 0<n???10000
# ???1000000???ai???1000000
# Sample Input
# 5
# 10 1 5 4 17
# Sample Output
# 1 17 37

num = int(input())
num_min = 1000001
num_max = -1000001
num_sum = 0

a = []
a=[ *map(int,input().split() ) ]

# for i in range(num):
# 	if a[i]<num_min:
# 		num_min = a[i]

# 	if a[i]>num_max:
# 		num_max = a[i]

# 	num_sum+=a[i]

# print("{0} {1} {2}".format(num_min,num_max,num_sum) );

### FIXED CODE ###

# 09-Computation-Min_Max_and_Sum.py

# ????°????????????§??????????¨????
# n ????????´??° ai(i=1,2,...n)?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????

# Input
# ??????????????´??°?????° n ???????????????????????????????????? n ????????´??° ai ????????????????????§?????????????????????
# Output
# ????°????????????§??????????¨????????????????????????§????????????????????????????????????

# Constraints
# 0<n???10000
# ???1000000???ai???1000000
# Sample Input
# 5
# 10 1 5 4 17
# Sample Output
# 1 17 37

num_min = 1000001
num_max = -1000001
num_sum = 0
num = int(input())

# a = []
# a = [ *map(int,input().split() ) ]
a = input().split()

for i in range(num):
	a[i]=int(a[i])
	if a[i]<num_min:
		num_min = a[i]

	if a[i]>num_max:
		num_max = a[i]

	num_sum+=a[i]

print("{0} {1} {2}".format(num_min,num_max,num_sum) );
import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()])

ans = 0; n = 2
while (a % n == 0).all():
    n *= 2
    ans += 1

print(ans)

### FIXED CODE ###

import numpy as np

n = int(input())
a = np.array([int(i) for i in input().split()])

ans = 0; n = 2
while (a % n == 0).all():
    n *= 2
    ans += 1

print(ans)
n, T = map(input().split(), int)
res = 2000
for _ in range(n):
  c, t = map(input().split(), int)
  if t > T: continue
  res = min(res, c)
if res == 2000:
  print('TLE')
else:
  print(res)

### FIXED CODE ###

n = int(input())
if n == 1:
  print('Hello World\n')
else:
  a = int(input())
  b = int(input())
  print(a + b)
_, k = input().split()
 
prices = input().split().map(lambda x : int(x))
 
prices.sort()
 
sum = 0
for i in range(int(k)):
	sum += prices[i]
print(sum)

### FIXED CODE ###

_, k = input().split()
 
prices = list(map(lambda x : int(x), input().split()))
 
prices.sort()
 
sum = 0
for i in range(int(k)):
	sum += prices[i]
print(sum)
N = int(input())
A = list(map(int, input().split())
ans = 1
for i in range[N]:
    ans = ans*A[i]

if ans<= 10**18:
    print(ans)
    exit(0)
else:
    print(-1)
         

### FIXED CODE ###

import sys  # sys.exit()を使いたいので

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

if 0 in a:
# 0が1つでもあれば0です
    print(0)
else:
# 0がない場合
    cur = 1  # 現在の数値
    for x in a:
        cur *= x
        if cur > 10 ** 18:
        # 10**18を超えたので終了します
            print(-1)
            sys.exit()
    print(cur)  # 10**18以下なので、出力します
str_len,input_str = map(str, input().split())
half = int(int(str_len)/2)
if(str_len % 2 == 0 and input_str[0:half] == input_str[half:str_len]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

str_len = int(input())
input_str = str(input())
half = int(int(str_len)/2)
if(str_len % 2 == 0 and input_str[0:half] == input_str[half:str_len]):
  print("Yes")
else:
  print("No")
N, K = map(int,input().split())
if N + 1 >= 2 * K:
    print('YES')
ele:
    print('NO')

### FIXED CODE ###

N, K = map(int,input().split())
if N + 1 >= 2 * K:
    print('YES')
else:
    print('NO')
import numpy as np

N, K = (int(x) for x in input().split())
A = np.array(list(int(x) for x in input().split()), dtype='uint64')

fmax = 0
for x in range(K+1):
    i = np.arange(N, dtype='uint64')
    fx = np.sum(np.bitwise_xor(A, i, dtype='uint64'), dtype='uint64')
    if fmax < fx:
        fmax = fx
print(fmax)

### FIXED CODE ###

T, X = (int(x) for x in input().split())
print(T/X)
N = input()
print(N // 2 + N % 2)

### FIXED CODE ###

N = int(input())
print(N // 2 + N % 2)
r = int(input())
import math
a = r*r*math.pi
b = r*2*math.pi
print('%s %s'%(a,b))

### FIXED CODE ###

r = float(input())
import math
a = r*r*math.pi
b = r*2*math.pi
print('%s %s'%(a,b))
s1,s2,s3=input().split('/')
s=s1+s2+s3
if s<=20190430:print('Heisei')
else:print('TBD')

### FIXED CODE ###

s=input().split('/')
if int(s[0])<2018:print('Heisei')
elif int(s[0])==2019 and int(s[1])<=4:print('Heisei')
else:print('TBD')
N = input()
A = list(map(float, input().split()))
deno = 1
for i in range(N):
    deno += 1/A[i]
print(1/deno)


### FIXED CODE ###

N = int(input())
A = list(map(float, input().split()))
deno = 0
for i in range(N):
    deno += 1/A[i]
print(1/deno)
N = int(input())
K = int(input())
S = [input()]

S[K - 1] = S[K - 1].lower()
print(''.join(S))


### FIXED CODE ###

N, K = (int(i) for i in input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()
print(''.join(S))
N,M,X=map(int, input().split())
A=list(map(int, input().split()))
print(min([len([1 for a in A if a>X]),len([1 for a in A if a<X])])

### FIXED CODE ###

N,M,X=map(int, input().split())
A=list(map(int, input().split()))
print(min([len([1 for a in A if a>X]),len([1 for a in A if a<X])]))
n = int(input())
egara = ["S ", "H ", "C ", "D "]
remind = []
for i in range(n):
   remind.append(input())

for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in a:
         print(egara[i] + str(j))


### FIXED CODE ###

n = int(input())

remind = []
for i in range(n):
   remind.append(input())

egara = ["S ", "H ", "C ", "D "]
for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in remind:
         print(egara[i] + str(j))
n, x = (int(i) for i in input().split()) 
a = sorted([int(i) for i in input().split()])

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

import functools

if len(a) == 1:
    print(a[0] - x)
    exit()

diff = []
for i in range(len(a)-1):
    diff.append(a[i+1] - a[i])

list_gcd = functools.reduce(gcd, diff)

import bisect

bi_index = bisect.bisect_left(a, x)
if a[bi_index] == x:
    print(list_gcd)
    exit()

if bi_index == 0:
    print(gcd(list_gcd, a[0]-x))
    exit()

if bi_index == len(a):
    print(gcd(list_gcd, x-a[-1]))
    exit()

print(functools.reduce(gcd, [list_gcd, x-a[bi_index-1], a[bi_index]-x ]))


### FIXED CODE ###

n, x = (int(i) for i in input().split()) 
a = sorted(list(set([int(i) for i in input().split()])))

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

import functools

if len(a) == 1:
    print(abs(a[0] - x))
    exit()

diff = []
for i in range(len(a)-1):
    diff.append(a[i+1] - a[i])

list_gcd = functools.reduce(gcd, diff)

import bisect

bi_index = bisect.bisect_left(a, x)
if bi_index == len(a):
    print(gcd(list_gcd, x-a[-1]))
    exit()

if a[bi_index] == x:
    print(list_gcd)
    exit()

if bi_index == 0:
    print(gcd(list_gcd, a[0]-x))
    exit()

print(functools.reduce(gcd, [list_gcd, x-a[bi_index-1], a[bi_index]-x ]))
x, N = map(int, input().split())
p = list(map(int, input().split()))

min =10000
temp = 0

for i in range(-1000, 1000):
  temp = abs(X - i)
  
  if temp < min and i not in p:
    min = temp
    
print(min)


### FIXED CODE ###

x, N = map(int, input().split())
p = list(map(int, input().split()))

min =10000
temp = 0
num = 10000

for i in range(-1000, 1000):
  temp = abs(x- i)
  
  if temp < min and i not in p:
    min = temp
    num = i
    
print(num)
def main():
    n = int(input())
    nums = list(map(int, input().split()))
    
    if 0 in nums:
        print(0)
        return
    
    mul = 1
    for i in nums:
        mul *= nums
        if mul >= 1000000000000000000:
            print(-1)
            return
        
    print(mul)
    
main()

### FIXED CODE ###

def main():
    n = int(input())
    nums = list(map(int, input().split()))
    
    if 0 in nums:
        print(0)
        return
    
    mul = 1
    for i in nums:
        mul *= i
        if mul > 1000000000000000000:
            print(-1)
            return
        
    print(mul)
    
main()
a = int(input())
b=[int(input()) for i in range(2)]
c=b[0]+b[1]
if a == 1:
  print('Hello World')
else:
  print(c)

### FIXED CODE ###

a = int(input())
if a == 1:
  print('Hello World')
else:
  b=[int(input()) for i in range(2)]
  c=b[0]+b[1]


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

place = 0
memory = [0]

for i in range(n):
    place = a[place]-1
    if not place in memory:
        memory.append(place)
    else:
        if a[place] in memory:
            loopstart = memory.index(a[place])
            k -= loopstart
            extra = k % (len(memory) - loopstart)
            if extra == 0:
                ans = memory[-1]+1
            else:
                ans = memory[place+extra-1]+1
            break
        else:
            ans = a[place]
            break
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i)-1 for i in input().split()]

p = 0

if n>=k:
    for i in range(k):
        p = a[p]
    print(p+1)

else:
    lst = [-1]*n
    lst[0] = 0
    
    for i in range(1,n+1):
        p = a[p]
        if lst[p] == -1:
            lst[p] = i
        else:
            loop = i - lst[p]
            k -= lst[p]
            extra = k % loop
            break

    for i in range(extra):
        p = a[p]
    print(p+1)
s = input()
midLen = len(s) - 2

print(s[0] + midLen + s[-1])

### FIXED CODE ###

s = input()
midLen = len(s) - 2
 
print(s[0] + str(midLen) + s[-1])
A, B = map(int, input().split())

ans = 0
consent = 1

while consent < B
    ans += 1
    consent -= 1
    consent -= A
print(ans)


### FIXED CODE ###

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

ans = 0
consent = 1

while consent < B:
    ans += 1
    consent -= 1
    consent += A
print(ans)
n = int(input())

if n%1000 = 0:
    print(n / 1000)
else 
    print(n/1000+1)



### FIXED CODE ###

n = int(input())

if n % 1000 == 0:
    print(0)
else:
    print(1000-n%1000)
import math
A,B = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(A,B))

### FIXED CODE ###

import fractions
try:
    A,B = map(int,input().split())
    def lcm(x, y):
        return (x * y) // fractions.gcd(x, y)
    print(lcm(A,B))
except EOFError:
    pass
n,*a = map(int,open(0).read().split())
b = [0,0,0]
ans = 1
mod = 10**9+7
for i in a:
  ans = (ans * b.count(i)) % mod
  b.remove(i)
  b.append(i + 1)
print(ans)

### FIXED CODE ###

n,*a = map(int,open(0).read().split())
cnt = [3]+[0]*n
ans = 1
mod = 10**9+7
for i in a:
  ans = ans * cnt[i] % mod
  cnt[i] -= 1
  cnt[i+1] += 1
print(ans)
# -*- coding: utf-8 -*-

import re



n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0
mask = 10**9 + 7

pow = [0]*n+2

tmp = 1
for i in range(1, n+2):
        tmp *= i
        pow[i] = tmp

for i in range(0, n + 1):
        x = a.index(a[i])
        if a[i] in a[x+1:]:
                left = i
                right = a[x+1:].index(a[i]) + x + 1
                break

for i in range(1, n + 2):
        ans = (pow[n + 1] / (pow[i] * pow[n + 1 - i]))
        x = (pow[left + n - right] / (pow[i - 1] * pow[left + n - right - i + 1]))
        print (ans - x) % mask


### FIXED CODE ###

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

from collections import Counter
import re

def pow(a, x):
        y = 1
        p = a % mask
        n = x
        while (n > 0):
                if ((n % 2) == 0):
                        p = (p * p) % mask
                        n /= 2
                else:   
                        y = (y * p) % mask
                        n -= 1
        return y

n = int(raw_input())
a = map(int, re.split("\s", raw_input()))
left = 0
right = 0

mask = 10**9 + 7
invm = 10**9 + 5

com = [1]*(n+2)
inv = [1]*(n+2)

tmp = 1 
for i in range(1, n+2):
        tmp = (tmp * i) % mask
        com[i] = tmp
        inv[i] = pow(tmp, invm) % mask

counter = Counter(a)
dup = counter.most_common(1)[0][0]
left = a.index(dup)
right = a[left+1:].index(dup) + left + 1

for i in range(1, n + 2):
        ans = (com[n + 1] * (inv[i] * inv[n + 1 - i]))

        if ((left + n - right - i + 1) >= 0):
                ans -= (com[left + n - right] * inv[i - 1] * inv[left + n - right - i + 1])
        print ans % mask
import bisect

S=int(input())
A=[int(i) for i in input().split()]

T=int(input())
B=[int(i) for i in input().split()]

l=0
r=len(S)
c=(r+l)/2

n=0


for i in B:
    if i in A:
        n+=1
    elif A[i-1]>c:
        l=c
        c=(r+l)/2
    elif A[i-1]<c:
        r=c
        c=(r+l)/2

print(n)



### FIXED CODE ###


def bs(A, n):
    l=0
    r=len(A)
    while l<r:
        mid=int((l+r)/2)
        if A[mid]==n:
            return mid
        else:
            if n<A[mid]:
                r=mid
            else:
                l=mid+1

    return -1

S=int(input())
A=[int(i) for i in input().split()]

T=int(input())
B=[int(j) for j in input().split()]

A.sort()

cnt=0
for i in range(T):
    x=bs(A,B[i])
    if x!=(-1):
        cnt=cnt+1

print(cnt)
K = int(input())
S = input()
ls = list(S)
if len(S) >= K:
  ansl = ls[0:K-1]
print(''.join(ansl) + '...')

### FIXED CODE ###

K = int(input())
S = input()
ls = list(S)
if len(S) > K:
  ansl = ls[0:K]
  print(''.join(ansl) + '...')
else:
  print(S)