Harryxun/stf_run huggingface dataset:
N, L = 0, 0
def loadIcicle():
	N, L = 0, 0
	i = 0
	icicles = []

	line = sys.stdin.readline().strip()
	while True:
		if i == 0:
			N, L = int(line.split(" ")[0]), int(line.split(" ")[1])
			i += 1
			continue
		line = sys.stdin.readline().strip()
		if line == "": break
		icicles.append(int(line))
		i += 1
		if i == N+1: break
	return icicles, N, L
icicles, N, L = loadIcicle()

def calcDiff(icicles, N):
	diff_2times = []
	for _ in range(len(icicles)):
		diff_2times.append(0)

	for idx in range(len(icicles)):
		dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx]
		dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx]

		peak = dif_left * dif_right < 0
		if peak and dif_left > 0: diff_2times[idx] = -1
		elif peak and dif_right > 0: diff_2times[idx] = 1
		else: diff_2times[idx] = 0

	return diff_2times

diff_2times = calcDiff(icicles, N)

time = []
for _ in range(len(icicles)):
	time.append(-1)

for i in range(len(icicles)):
	if diff_2times[i] == -1:
		time[i] = L - icicles[i]

for i in range(len(icicles)):
	if time[i] == -1: pass
	else: continue

	if diff_2times[i] == 0: pass
	else: continue

	if time[i-1] != -1: time[i] = (L-icicles[i]) + time[i-1]
	elif time[i+1] != -1: time[i] = (L-icicles[i]) + time[i+1]

for i in range(len(icicles)):
	if time[i] == -1: pass
	else: continue

	if diff_2times[i] == 1: pass
	else: continue

	time[i] = (L-icicles[i]) + max(time[i-1], time[i+1])

print(max(time))

### FIXED CODE ###

def loadIcicle():
	icicles = []
	line = input().strip().split(" ")
	N, L = int(line[0]), int(line[1])
	while True:
		icicles.append(int(input().strip()))
		if len(icicles) == N: break
	return icicles, N, L

def calcDiff(icicles, N):
	diff_2times = [0]*N

	for idx in range(N):
		dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx]
		dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx]

		dif_right = 1 if dif_right > 0 else -1
		dif_left = 1 if dif_left > 0 else -1

		if dif_right - dif_left < 0: diff_2times[idx] = -1
		elif dif_right - dif_left > 0: diff_2times[idx] = 1
		else: diff_2times[idx] = 0

	return diff_2times

icicles, N, L = loadIcicle()
diff_2times = calcDiff(icicles, N)

time = [-1]*N
peakX = [i for i in range(N) if diff_2times[i]==-1]
for i in peakX:
	time[i] = L - icicles[i]

	isLocalMinL, isLocalMinR = False, False
	posL, posR = i, i
	while not (isLocalMinL and isLocalMinR):
		posL -= 1
		if posL < 0:
			isLocalMinL = True
		if not isLocalMinL:
			if time[posL] == -1:
				time[posL] = (L-icicles[posL]) + time[posL+1]
			else:
				time[posL] = (L-icicles[posL]) + max(time[posL-1], time[posL+1])

			if diff_2times[posL] == 1:
				isLocalMinL = True

		posR += 1
		if posR >= N:
			isLocalMinR = True
		if not isLocalMinR:
			if time[posR] == -1:
				time[posR] = (L-icicles[posR]) + time[posR-1]
			else:
				time[posR] = (L-icicles[posR]) + max(time[posR-1], time[posR+1])

			if diff_2times[posR] == 1:
				isLocalMinR = True

print(max(time))
n = int(input())
h = list(map(int,input().split()))

for x in range(n-1):
    if h[x] <= h[x+1]:
        pass
    else:
        h[x] = h[x]-1

if n == 1:
    ans ='Yes'
for x in range(n-1):
    if h[x] <= h[x+1]:
        ans = 'Yes'
    else:
        ans = 'No'
        break
if h[n-1] <= h[n] and ans ='Yes':
    ans ='Yes'
if h[n-1] <= h[n] and ans ='No':
    ans ='No'

print(ans)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
for i in range(N - 1):
  diff = H[i + 1] - H[i]
  if diff >= 1:
    H[i + 1] -= 1
  elif diff < 0:
    ans = "No"
print(ans)
import sys

from itertools import combinations

n, m = map(int, input().split())
survivors = {v: {v + 1} for v in range(n)}
for x, y in reversed(map(int, line.split()) for line in sys.stdin.readlines()):
    for v, srv in survivors.copy().items():
        if x in srv:
            if y in srv:
                del survivors[v]
            else:
                srv.add(y)
        elif y in srv:
            srv.add(x)
print(sum(su.isdisjoint(sv) for su, sv in combinations(survivors.values(), 2)))


### FIXED CODE ###

def get_survivors(n, pairs):
    survivors = {v: {v} for v in range(n)}
    for x, y in reversed(pairs):
        for v, srv in survivors.copy().items():
            if x in srv:
                if y in srv:
                    del survivors[v]
                else:
                    srv.add(y)
            elif y in srv:
                srv.add(x)
    return survivors


def solve(n, pairs):
    survivors = get_survivors(n, pairs)
    ans = 0
    for u, su in survivors.items():
        for v, sv in survivors.items():
            if u >= v:
                continue
            if su.isdisjoint(sv):
                ans += 1
    return ans


n, m = map(int, input().split())
pairs = []
for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    pairs.append((x, y))
print(solve(n, pairs))
def f_c():
    import math
    n = int(input())
    s = input()

    stack, c = [1], 1
    for i in range(1, n*2):
        if s[i]=="B":
            if len(stack)%2==0:
                stack.append(1)
            else:
                c *= len(stack)
                stack.pop()
        else:
            if len(stack)%2==0:
                c *= len(stack)
                stack.pop()
            else:
                stack.append(1)
    o = 0 if len(stack)!=0 else c*math.factorial(n)
    print(o)

if __name__ == "__main__":
    f_c()


### FIXED CODE ###

# import sys
# input = sys.stdin.readline
Q = 10**9+7
def main():
    N = int( input())
    S = input()
    left = 0
    ans = 1
    # for i in range(N*2):
    #     s = S[i]
    for s in S:
        if s == "B":
            if left%2 == 0:
                left += 1
            else:
                ans *= left
                left -= 1
        else:
            if left%2 == 1:
                left += 1
            else:
                ans *= left
                left -= 1
        ans %= Q
    if left > 0 or ans == 0:
        print(0)
        return
    for i in range(1,N+1):
        ans *= i
        ans %= Q
    print(ans)
if __name__ == '__main__':
    main()
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for _ in range(M)]
G1 = collections.defaultdict(lambda: collections.defaultdict(int))
G2 = collections.defaultdict(lambda: collections.defaultdict(int))

for u, v, a, b in UVAB:
    u -= 1
    v -= 1
    G1[u][v] = G1[v][u] = a
    G2[u][v] = G2[v][u] = b


def dijkstra(V, G, i):
    INF = float('inf')

    H = []
    d = 0
    D = [INF] * V
    D[i] = 0
    used = [False] * V
    used[i] = True

    while True:
        for j in G[i].keys():
            heapq.heappush(H, (d + G[i][j], j))
        v = -1
        while H:
            d, j = heapq.heappop(H)
            if not used[j]:
                v = j
                break
        if v == -1:
            break
        else:
            used[v] = True
            D[v] = d
            i = v
    return D


D1 = dijkstra(N, G1, S - 1)
D2 = dijkstra(N, G2, T - 1)

D = [
    _ for _ in itertools.accumulate(
        [10**15 - sum(_) for _ in zip(D1, D2)][::-1], func=max)
][::-1]
print(*D, sep='\n')


### FIXED CODE ###

import math, string, itertools, fractions, collections, re, array, bisect, sys, random, time, copy, functools
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
input = sys.stdin.readline

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for _ in range(M)]
G1 = collections.defaultdict(lambda: collections.defaultdict(int))
G2 = collections.defaultdict(lambda: collections.defaultdict(int))

for u, v, a, b in UVAB:
    u -= 1
    v -= 1
    G1[u][v] = G1[v][u] = a
    G2[u][v] = G2[v][u] = b


def dijkstra(V, G, start):
    INF = float('inf')
    D = [INF for _ in range(V)]
    D[start] = 0
    H = [(0, start)]
    while H:
        du, u = heappop(H)
        if D[u] < du:
            continue
        for v, d in G[u].items():
            if D[v] > du + d:
                D[v] = du + d
                heappush(H, (D[v], v))
    return D


D1 = dijkstra(N, G1, S - 1)
D2 = dijkstra(N, G2, T - 1)

D = [10**15 - sum(_) for _ in zip(D1, D2)]
for i in range(N - 1, 0, -1):
    D[i - 1] = max(D[i - 1], D[i])
print(*D, sep='\n')
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AL,AR = {},{} 
BL,BR = {},{}
for i in range(N):
    if not A[i] in AL:
        AL[A[i]] = i
    AR[A[i]] = i

for i in range(N):
    if not B[i] in BL:
        BL[B[i]] = i
    BR[B[i]] = i
can = [1]*(N)

for i in BL.keys():
    if not i in AL:
        continue
    s = (N+AL[i]-BR[i])%N
    e = (N+AR[i]-BL[i])%N
    if e<s:
        e += N
    # print(i,s,e)
    for j in range(s,e+1):
        can[j%N] = 0

if 1 in can:
    print("Yes")
    ind = can.index(1)
    print(* (B+B)[N-ind:2*N-ind])
else:
    print(1/0)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AC = Counter(A)
BC = Counter(B)
for i in BC.keys():
    if i in AC and BC[i] + AC[i] > N:
        print("No")
        exit()
AL,AR = {},{} 
BL,BR = {},{}
for i in range(N):
    if not A[i] in AL:
        AL[A[i]] = i
    AR[A[i]] = i

for i in range(N):
    if not B[i] in BL:
        BL[B[i]] = i
    BR[B[i]] = i
can = [1]*(N)

for i in BL.keys():
    if not i in AL:
        continue
    s = (N+AL[i]-BR[i])%N
    e = (N+AR[i]-BL[i])%N
    if e<s:
        e += N
    # print(i,s,e)
    for j in range(s,e+1):
        can[j%N] = 0

if 1 in can:
    print("Yes")
    ind = can.index(1)
    print(* (B+B)[N-ind:2*N-ind])
else:
    print("No")
ZABCZ

### FIXED CODE ###

s = input()
for i in range(len(s)):
    if s[i] == 'A':
        A_idx = i
        break
for i in range(len(s)):
    if s[i] == 'Z':
        Z_idx = i
print(Z_idx - A_idx + 1)
n=int(input())
d=list(map(int,input.split()))
sam=0

for i in range(n):
  for j in range(n-1):
    sam=sam+(d[i]*d[J+1])

print(sam)

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
sam=0

for i in range(n):
  for j in range(i+1,n): 
    sam=sam+(d[i]*d[j]) 
    

print(sam)
s = str(input())
q = int(input())
state = True
front = []
end = []
for _ in range(q):
  qi = str(input())
  if qi[0] == "2":
    fi,ci = map(str,qi[2:].split())
    if state == True:
      if fi == "1":
        front.append(ci)
      else:
        end.append(ci)
    else:
      if fi == "1":
        end.append(ci)
      else:
        front.append(ci)
  else:
    state = not state
if state:
  first = reversed(front)
  last = end
else:
  first = reversed(end)
  last = front
  s = s[::-1]
for f in first:
  print(f,end="")
for si in s:
  print(s,end="")
for l in last:
  print(l,end="")




### FIXED CODE ###

s = str(input())
q = int(input())
state = True
front = ""
ending = ""
for _ in range(q):
  qi = str(input())
  if qi[0] == "2":
    fi,ci = map(str,qi[2:].split())
    if state == True:
      if fi == "1":
        front += ci
      else:
        ending += ci
    else:
      if fi == "1":
        ending += ci
      else:
        front += ci
  else:
    state = not state
if state:
  first = front[::-1]
  lastt = ending
else:
  first = ending[::-1]
  lastt = front
  s = s[::-1]
print(first+s+lastt)
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
print(L)
for x in range(K):
    del L[-1]
print(sum(L))

### FIXED CODE ###

import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))
import sys
input = sys.stdin.readline
import math
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(A * B // math.gcd(A, B))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)

### FIXED CODE ###

import sys
input = sys.stdin.readline
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(A * B // gcd(A, B))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)
import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()

def dp(i,j):
    if i == 0:
        if j == 0: return A_li[0]
        elif j == 1: return -A_li[0]
    else:
        if j == 0: return max(dp(i-1, 0) + A_li[i], dp(i-1, 1) - A_li[i])
        if j == 1: return max(dp(i-1, 0) - A_li[i], dp(i-1, 1) + A_li[i])

print(dp(N-1,0))


### FIXED CODE ###

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()

import numpy as np

A_abs = np.abs(A_li)
A_neg_count = sum([1 if i<0 else 0 for i in A_li])

if 0 in A_li or A_neg_count%2 == 0: print(sum(A_abs))
else: print(sum(A_abs) - 2 * min(A_abs))
def readInts():
  return list(map(int, input(), split()))

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    cnt +=1
    
if cnt >= m: print("Yes")
  else: print("No")
  

### FIXED CODE ###

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

n, m = readInts()
a = readInts()
s = sum(a)
cnt = 0
for i in range(n):
  if a[i]*4*m >=s:
    cnt +=1
    
if cnt >= m:
  print("Yes")
else:
  print("No")
A,B=input().split()
A_=[A[:-2],A[-2:]]

if A_[0]=='':
    A_[0]='0'
    
A_[0]=int(A_[0])*100
A_[1]=int( A_[1])

A,B=input_[0].split()

B=float(B)
print(int(A_[0]*B + A_[1]*B))

### FIXED CODE ###

A,B=input().split()
A=int(A)
B=int(B.replace('.', ''))
print(int(A*B//100))
n = str(input())
print(int(n[1:4]))

### FIXED CODE ###

n = int(input())

if n <= 1000:
    print(1000-n)
elif 1000< n <=2000:
    print(2000-n) 
elif 2000< n <=3000:
    print(3000-n)
elif 3000< n <=4000:
    print(4000-n)
elif 4000< n <=5000:
    print(5000-n)
elif 5000< n <=6000:
    print(6000-n)
elif 6000< n <=7000:
    print(7000-n)
elif 7000< n <=8000:
    print(8000-n)
elif 8000< n <=9000:
    print(9000-n)
elif 9000< n <=10000:
    print(10000-n)
S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print h, ":", m, ":", t

### FIXED CODE ###

S = input()
h = S // 3600
m = S % 3600 //60
s = S % 3600 % 60
print str(h) + ':' + str(m) + ':' + str(s)
N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
k=26
l=1
while N-k>0:
  N-=k
  k*=26
  l+=1
ans=""
N-=1
while N>26:
  a=N%26
  N=N//26
  ans=alpha[a]+ans
ans=alpha[N]+ans
k=len(ans)
for i in range(k,l):
  ans="a"+ans
print(ans)


### FIXED CODE ###

N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
ans=""
while True:
  N-=1
  a=N%26
  N=N//26
  ans=alpha[a]+ans
  
  if N==0:
    break
print(ans)
a, b = map(int, input().split())

if (a*b) % 2:
    print('Odd')
else:
    print('Even')

### FIXED CODE ###

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

if (a*b) % 2:
    print('Odd')
else:
    print('Even')
import sys
import  math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect

stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

H,W,M=nm()
r=[0]*(10**6)
c=[0]*(10**6)
mass=set()
for i in range(M):
    h,w=nm()
    mass.add(H*h+w)
    r[h]+=1
    c[w]+=1

rl=[]
cl=[]

r_max=0
for i in range(1,H+1):
    r_max=max(r[i],r_max)
    
c_max=0
for i in range(1,W+1):
    c_max=max(c[i],c_max)

for i in range(1,H+1):
    if(r[i]==r_max):
        rl.append(i)

for i in range(1,W+1):
    if(c[i]==c_max):
        cl.append(i)



for i in rl:
    for j in cl:
        if(i*H+j not in mass):
            print(r[0]+c[0])
            sys.exit(0)


print(r[0]+c[0]-1)


### FIXED CODE ###

import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N,X,T=nm()
if(N%X==0):
    ans=(N//X)*T
else:
    ans=(N//X+1)*T

print(ans)
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K+1)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)


### FIXED CODE ###

S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
else:
  ans = '1'
  for i in range(K)[1:]:
    if S[i] != '1':
      ans = S[i]
      break
  print(ans)
inp1 = input().split()
inp2 = input().split()
a = int(inp1[0])
b = inp2
b = [int(s) for s in inp2]
ansno = a
maxno = b[0]

ii = 0
for i in b:
  if ii ==0:
    ii+=1
    continue
  bslice = b[:ii+1]
#  print(ii)
#  print(bslice)
  if min(bslice) != i:
#    print("min(bslice)",min(bslice)," i ",i)
    ansno -=1
  ii+=1
#  print("ansno: ",ansno)
print(ansno)


### FIXED CODE ###

inp1 = input().split()
a = int(inp1[0])
b = int(inp1[1])

if b ==0:
  print("No")
else:
  c = a%b
  if c == 0:
    print("Yes")
  else:
    print("No")
print(eval(input().replace(' ','%'))

### FIXED CODE ###

n, k = map(int, input().split())
print((n + k - 1) // k - n // k)
n=raw_input()
x=raw_input().split()

for i in reversed(len(x)):
  print x[i],

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,
n=int(input())
s=input()
k=int(input())
key=s[k]
ans=""
for i in range(len(s)):
  if s[i]==key:
    ans+=key
  else:
    ans+="*"
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
k=int(input())
key=s[k-1]
ans=""
for i in range(len(s)):
  if s[i]==key:
    ans+=key
  else:
    ans+="*"
print(ans)
A,B,C = (input() for i in range(3))
count_A=1
count_B=0
count_C=0
arr = A[0]
for i in range(len(A)+len(B)+len(C)):
    if arr=='a':
        count_A+=1
    elif arr=='b':
        count_B+=1
    else:
        count_C+=1
    if count_A==len(A):
        print('A')
        break
    elif count_B==len(B):
        print('B')
        break
    elif count_C==len(C):
        print('C')
        break
    arr = A[count_A] if arr=='a' else B[count_B] if arr=='b' else C[count_C]

### FIXED CODE ###

a = input()
b = input()
c = input()
win = 'a'
while len(a)>=0 and len(b)>=0 and len(c)>=0:
    if win == 'a':
        if len(a)==0:
            break
        win = a[0]
        a = a[1:]
    elif win == 'b':
        if len(b)==0:
            break
        win = b[0]
        b = b[1:]
    else:
        if len(c)==0:
            break
        win = c[0]
        c = c[1:]
print('A' if win == 'a' else 'B' if win == 'b' else 'C')
n = int(input())
A = list(map(int, input().split()))

def ssa(n):
    arr = A
    memo =['inf'] * (n + 1)
    def _ssa(n):
        if n == 0:
            return arr[0]
        if memo[n] != 'inf':
            return memo[n]
        memo[n] = _ssa(n -1) + arr[n]
        return memo[n]
    return _ssa(n)

cnt = 0
chg = 0
for i in range(n - 1):
    if ssa(i) + chg > 0:
        if ssa(i + 1) + chg >= 0:
            cnt += ssa(i + 1) + chg + 1
            chg += -(ssa(i + 1)+ chg  + 1)
    elif ssa(i) + chg < 0:
        if ssa(i + 1) + chg <= 0:
            cnt += 1 - ssa(i + 1) - chg
            chg += 1 - ssa(i + 1) - chg

if ssa(n - 1) + chg == 0:
    cnt +=1

print(cnt)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = [a_ for a_ in a]
 
ans = 10**14
for a0 in [-1,a[0],1]:
    if a0 == 0:
        continue
    ans_ = abs(a[0]-a0)
    b[0] = a0
    sign = b[0] > 0
    for i in range(1,n):
        b[i] = a[i]+b[i-1]
        if sign:
            if b[i] >= 0:
                ans_ += b[i]+1
                b[i] = -1
        else:
            if b[i] <= 0:
                ans_ += 1-b[i]
                b[i] = 1
        sign = not sign
    ans = min(ans, ans_)
print(ans)
x = int(input())

a = 0
b = -1

while True:
  b += 1
  a = (x + b**5)**0.2
  if a == int(a):
    a = int(a)
    break
  a = (x - b**5)**0.2
  if a == int(a):
    a = int(a)
    b = -b
    break

a = str(a)
b = str(b)
print(a + ' ' + b)

### FIXED CODE ###

x = int(input())

a = 0
b = 0
flg = True

while True:
  a += 1
  for i in range(a):
    if a**5 - i**5 == x:
      a = a
      b = i
      flg = False
      break
    elif a**5 + i**5 == x:
      a = a
      b = -i
      flg = False
      break
  if flg == False:
    break
  
a = str(a)
b = str(b)
print(a+' '+b)
def gcd(a,b):
    #a=min(a,b)
    #b=max(a,b)
    while b:
        a,b= b, a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)
T=[]
N=int(input())
for i in range(N):
    T.append(int(input()))

ans=1
for t in T:
    ans=lcm(ans, t)

print(ans)

### FIXED CODE ###

S=list(map(int, input()))

if S[0]==S[2]:
    print('Yes')
else:
    print('No')
k=int(input())

print(li[k-1])

### FIXED CODE ###

li=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(li[k-1])
import sys
input = lambda: sys.stdin.readline().rstrip()

order = [int(input()) for _ in range(5)]

extra_list = []

tmp = 11
for i in range(5):
    extra = order[i] % 10
    if extra != 0:
        if extra < tmp:
            tmp = extra
            extra_list.append(i)

ans = 0
for i in range(5):
    if i == extra_list[-1]:
        continue
    if order[i] % 10 == 0:
        ans += order[i]
    else:
        ans += 10 * (order[i] // 10 + 1)

print(ans + order[extra_list[-1]])

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()

order = [int(input()) for _ in range(5)]

extra_list = []

tmp = 11
for i in range(5):
    extra = order[i] % 10
    if extra != 0:
        if extra < tmp:
            tmp = extra
            extra_list.append(i)


ans = 0
for i in range(5):
    if extra_list and i == extra_list[-1]:
        continue
    if order[i] % 10 == 0:
        ans += order[i]
    else:
        ans += 10 * (order[i] // 10 + 1)
if extra_list:
    print(ans + order[extra_list[-1]])
else:
    print(ans)
s = input()
L = []
alp = [chr(ord('a') + i) for i in range(26)]
TF = [False]*26
for i in range(len(s)):
  if not s[i] in L:
    L.append(s[i])
    TF[ord(s[i])-97] = True
if len(L) != 26:
  for i in range(26):
    if TF[i] == False:
      k = alp[i]
      break
  print(s+k)
else:
  if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
  elif s == 'abcdefghijklmnopqrstuvwxyz':
    print('b')
  else:
    P = []
    for i in range(25,-1,-1):
      if s[i] > s[i-1]:
        break
      else:
        P.append(s[i-1])
        P.append(s[i])
    P.sort()
    print(s[0:i-1]+P[0])

### FIXED CODE ###

import sys
s = input()
L = []
alp = [chr(ord('a') + i) for i in range(26)]
TF = [False]*26
for i in range(len(s)):
  if not s[i] in L:
    L.append(s[i])
    TF[ord(s[i])-97] = True
if len(L) != 26:
  for i in range(26):
    if TF[i] == False:
      k = alp[i]
      break
  print(s+k)
else:
  right = s[-1]
  for i in reversed(range(len(s))):
    k = s[i]
    if k < right:
      for j in range(ord(k),ord(k)+26):
        if chr(j) in s[i+1:]:
          print(s[:i]+chr(j))
          break
      sys.exit()
    else:
      right = max(k,right)
  print(-1)