Harryxun/stf_run huggingface dataset:
import sys

lines = sys.stdin.readlines()

S = str(lines[0])
X = []

for i in range(len(S)):
  a = int(S[i:])
  c = a-int(a/2019)*2019
  X.append(c)

X.sort()
print(X)
flag =1
n = 0
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag = flag +1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
 
print(n)

### FIXED CODE ###

S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
n += int(flag*(flag-1)/2)
if X[len(X)-1]==0:
  n +=1
print(n)
N, M = map(int, input().split())
UV = [list(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())

if 0 == M:
	print(-1)
	exit()

s, t = S - 1, T - 1

graph = [[] for _ in range(N)]
for u, v in UV:
	graph[u - 1] += [v - 1]

INF = 10 ** 12
cost = [[INF, INF, INF] for _ in range(N)]
def print_cost(cost):
	for line in cost:
		for cell in line:
			print("  INF" if cell == INF else " {:4d}".format(cell), end="")
		print()
	print()

def dfs(graph, cost, c, d):
	if cost[c][d % 3] <= d:
		return
	cost[c][d % 3] = d
	#print_cost(cost)
	for n in graph[c]:
		dfs(graph, cost, n, d + 1)

dfs(graph, cost, s, 0)

print(cost[t][0] // 3 if 0 == cost[t][0] % 3 else -1)


### FIXED CODE ###

N, M = map(int, input().split())
UV = [list(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())

if 0 == M:
	print(-1)
	exit()

graph = [set() for _ in range(N)]
for u, v in UV:
	graph[u - 1] |= {v - 1}

INF = 10 ** 12
depths = [[INF, INF, INF] for _ in range(N)]

def bfs(start, end):
	depth = 0
	nodes = {start}
	while nodes:
		if (0 == depth % 3) and (end in nodes):
			return depth // 3
		next_nodes = set()
		for node in nodes:
			if depths[node][depth % 3] <= depth:
				continue
			depths[node][depth % 3] = depth
			next_nodes |= graph[node]
		nodes = next_nodes
		depth += 1
	return -1

print(bfs(S - 1, T - 1))
def div_with_mod(x, y, mod):
    # Fermat's little theorem
    return x*pow(y, mod - 2, mod)


def solve():
    N, K = map(int, input().split())
    mod = 10**9+7

    if K == N+1:
        print(1)
        exit()

    nc = N+1
    n = N+1
    r = K

    for rc in range(1, r):
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod

    ans = div_with_mod(n, r, mod) % mod
    rc += 1

    for k in range(rc, N+1):
        rc += 1
        nc -= 1
        n = n*nc % mod
        r = r*rc % mod
        a = div_with_mod(n, r, mod) % mod
        ans += a

    print(ans % mod)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

def div_with_mod(x, y, mod):
    # Fermat's little theorem
    return x*pow(y, mod - 2, mod)


def solve():
    N, K = map(int, input().split())
    mod = 10**9+7

    s = 0
    s_1 = 0
    a = []
    b = 0
    ans = 0
    for i in range(N+1):
        b += i
        a.append(b)

    for i in range(K, N+1):
        s = a[i-1]
        s_1 = a[N]-a[N-i]
        ans += s_1-s + 1
    print(ans % mod + 1)


if __name__ == "__main__":
    solve()
anntena = []
for i in range(5):
  anntena.append(int(input())
k = int(input())
                 
if anntena[4] - anntena[0] <= k:
  print('Yey!')
else:
  print(':(')


### FIXED CODE ###

max_distance = 0
previous = int(input())
for i in range(4):
    current = int(input())
    distance = current - previous
    if distance > max_distance:
        max_distance = distance

k = int(input())

if max_distance > k:
    print(":(")
else:
    print("Yay!")
from sys import stdin, gettrace
 
if not gettrace():
    def input():
        return next(stdin)[:-1]
 
 
# def input():
#    return stdin.buffer.readline()

def recursion(s1,s2,i,j,n1,n2,dp):
    if i>=n1 or j>=n2:
        return ""   
    if s1[i]==s2[j]:
        if dp[i+1][j+1]==-1:
            string=recursion(s1,s2,i+1,j+1,n1,n2,dp)
            dp[i+1][j+1]=string
        else:
            string=dp[i+1][j+1]
        return s1[i]+string
    else:
        if dp[i+1][j]==-1:
            x=recursion(s1,s2,i+1,j,n1,n2,dp)
            dp[i+1][j]=x
        else:
            x=dp[i+1][j]
        if dp[i][j+1]==-1:
            y=recursion(s1,s2,i,j+1,n1,n2,dp)
            dp[i][j+1]=y
        else:
            y=dp[i][j+1]
        if len(x)>len(y):
            return x
        else:
            return y

def main():
    s1=input()
    s2=input()
    n1,n2=len(s1),len(s2)
    dp=[[-1 for j in range(n2+1)] for i in range(n1+1)]
    print(recursion(s1,s2,0,0,len(s1),len(s2),dp))
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

s1=input()
s2=input()
n1,n2=len(s1),len(s2)
dp=[[-1 for j in range(n2+1)] for i in range(n1+1)]
for i in range(n1,-1,-1):
    for j in range(n2,-1,-1):
        if i==n1 or j==n2:
            dp[i][j]=0
        else:
            if s1[i]==s2[j]:
                dp[i][j]=1+dp[i+1][j+1]
            else:
                dp[i][j]=max(dp[i][j+1],dp[i+1][j])
n=""
i,j=0,0
while i<n1 and j<n2:
    if dp[i][j]==dp[i+1][j]:
        i+=1
    elif dp[i][j]==dp[i][j+1]:
        j+=1
    else:
        n+=s1[i]
        i+=1
        j+=1
print(n)
n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
half = k//2
while c > half:
    c = abs(c-k)
l.append(c)
print(min(l))

### FIXED CODE ###

n,k = map(int,input().split())
if n % k ==0:
    print(0)
else:
    l = [n]
    p = n//k
    c = n-(p*k)
    half = k//2
    while c > half:
        c = abs(c-k)
    l.append(c)
    print(min(l))
import sys
input = sys.stdin.readline


x = int(input())

prime = [True] * (100004)
prime[2] = True

def e_prime(x):
	i = 2
	flag = False
	if(i==x):flag=True
	while True:
		if prime[i]:
			if(flag==True):
				return i
			else:
				for j in range(i**2,len(prime),i):
					prime[j]=False
		i+=1

print(e_prime(x))


### FIXED CODE ###

import sys
input = sys.stdin.readline


x = int(input())

prime = [True] * (100004)
prime[2] = True

def e_prime(x):
	i = 2
	flag = False
	while True:
		if(i==x):flag=True
		if prime[i]:
			if(flag==True):
				return i
			else:
				for j in range(i**2,len(prime),i):
					prime[j]=False
		i+=1

print(e_prime(x))
if a >= 13:
    print(b)
elif a >= 6 and a <= 12:
    print(b//2)
else:
    print(0)

### FIXED CODE ###

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

hour = int(seconds // 3600)
minute = int(seconds % 3600 // 60)
second = int(seconds % 3600  % 60)

print(hour + ':' + minute + ':' + second)

### FIXED CODE ###

seconds = int(input())

hour = str(seconds // 3600)
minute = str(seconds % 3600 // 60)
second = str(seconds % 3600  % 60)

print(hour + ':' + minute + ':' + second)
s = input().strip()
N = len(s)
x,y = map(int,input().split())
AX = []
AY = []
flag = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        if flag==0:
            AX.append(cnt)
            cnt = 0
            flag = 1
        else:
            AY.append(cnt)
            cnt = 0
            flag = 0
if cnt>0 and flag==0:
    AX.append(cnt)
if cnt>0 and flag==1:
    AY.append(cnt)
dpX = [[0 for _ in range(2*N+1)] for _ in range(len(AX)+1)]
if s[0]=="F":
    dpX[1][N+AX[0]] = 1
    for i in range(1,len(AX)):
        for j in range(2*N+1):
            if 0<=j+AX[i]<=2*N:
                dpX[i+1][j+AX[i]] = dpX[i+1][j+AX[i]] or dpX[i][j]
            if 0<=j-AX[i]<=2*N:
                dpX[i+1][j-AX[i]] = dpX[i+1][j-AX[i]] or dpX[i][j]
else:
    dpX[0][N] = 1
    for i in range(len(AX)):
        for j in range(2*N+1):
            if 0<=j+AX[i]<=2*N:
                dpX[i+1][j+AX[i]] = dpX[i+1][j+AX[i]] or dpX[i][j]
            if 0<=j-AX[i]<=2*N:
                dpX[i+1][j-AX[i]] = dpX[i+1][j+AX[i]] or dpX[i][j]
dpY = [[0 for _ in range(2*N+1)] for _ in range(len(AY)+1)]
dpY[0][N] = 1
for i in range(len(AY)):
    for j in range(2*N+1):
        if 0<=j+AY[i]<=2*N:
            dpY[i+1][j+AY[i]] = dpY[i+1][j+AY[i]] or dpY[i][j]
        if 0<=j-AY[i]<=2*N:
            dpY[i+1][j-AY[i]] = dpY[i+1][j-AY[i]] or dpY[i][j]
if dpX[len(AX)][N+x]==1 and dpY[len(AY)][N+y]==1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input().strip()
x,y = map(int,input().split())
C = {}
cur = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        C[cur] = cnt
        cur += 1
        cnt = 0
C[cur] = cnt
AX = []
AY = []
for a in C:
    if a>0 and a%2==0 and C[a]>0:
        AX.append(C[a])
    elif a%2==1 and C[a]>0:
        AY.append(C[a])
cntx = sum(AX)
dpx = [[0 for _ in range(2*cntx+1)] for _ in range(len(AX)+1)]
dpx[0][cntx] = 1
if cntx>0:
    dpx[1][cntx-AX[0]] = 1
    dpx[1][cntx+AX[0]] = 1
    for i in range(2,len(AX)+1):
        for j in range(-cntx,cntx+1):
            if -cntx<=j-AX[i-1]:
                dpx[i][j+cntx] = dpx[i-1][j-AX[i-1]+cntx]
                if j+AX[i-1]<=cntx:
                    dpx[i][j+cntx] = max(dpx[i][j+cntx],dpx[i-1][j+AX[i-1]+cntx])
            elif j+AX[i-1]<=cntx:
                dpx[i][j+cntx] = dpx[i-1][j+AX[i-1]+cntx]
cnty = sum(AY)
dpy = [[0 for _ in range(2*cnty+1)] for _ in range(len(AY)+1)]
dpy[0][cnty] = 1
if cnty>0:
    dpy[1][cnty-AY[0]] = 1
    dpy[1][cnty+AY[0]] = 1
    for i in range(2,len(AY)+1):
        for j in range(-cnty,cnty+1):
            if -cnty<=j-AY[i-1]:
                dpy[i][j+cnty] = dpy[i-1][j-AY[i-1]+cnty]
                if j+AY[i-1]<=cnty:
                    dpy[i][j+cnty] = max(dpy[i][j+cnty],dpy[i-1][j+AY[i-1]+cnty])
            elif j+AY[i-1]<=cnty:
                dpy[i][j+cnty] = dpy[i-1][j+AY[i-1]+cnty]
if C[0]-cntx<=x<=C[0]+cntx and dpx[len(AX)][x-C[0]+cntx]==1 and -cnty<=y<=cnty and dpy[len(AY)][y+cnty]==1:
    print("Yes")
else:
    print("No")
ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

mid2 = a + b

if mid2 % 2 == 0:
    mid = mid2 / 2
  else:
    mid = 'IMPOSSIBLE'
    
print(mid)

### FIXED CODE ###

ab = list(map(int, input().split()))
a = ab[0]
b = ab[1]

mid2 = a + b

if mid2 % 2 == 0:
    mid = int(mid2 / 2)
else:
    mid = 'IMPOSSIBLE'
    
print(mid)
#1A:white
#0B:black
import math
I,J=map(int,input().split())
B=max(I,J)
A=min(I,J)
X=A+B
K=(B-A)//3
P=(B-A)%3
if P==0:
    X+=K
else:
    X+=K+1
n=int(math.sqrt(X))
p,q=0,0
for i in range(1,n+1):
    if X%i==0:
        p=i
        q=X//i
C=[[(i+j)%2 for i in range(p)] for j in range(q)]
N=0;M=0
for i in range(p):
    for j in range(q):
        if (i+j)%2==0:
            M+=1
        else:
            N+=1
flag=0
for i in range(1,p-1):
    for j in range(1,q-1):
        if C[i][j]==0:
            if A<N-3:
                C[i][j]=1
            else:
                flag=1
                break
    if flag==1:
            break
if P==1:
    for i in range(1,p-1):
        if C[0][i]==0:
            C[0][i]=1
            break
elif P==2:
    flag2=0
    for i in range(1,p-1):
        if C[0][i]==0:
            C[0][i]=1
            flag2+=1
        if flag2==2:
            break
print(p,q)
for i in range(p):
    st=""
    for j in range(q):
        if (C[i][j]==0 and J>I) or (C[i][j]==1 and I>=J):
            st+="#"
        else:
            st+="."
        print(st)


### FIXED CODE ###

A,B=map(int,input().split())
C=[[0 for i in range(100)] for i in range(100)]
for i in range(50,100):
    for j in range(100):
        C[i][j]=1
k=0
for i in range(50):
    for j in range(100):
        if (i*j)%2 ==1:
            if k<A-1:
                C[i][j]=1
                k+=1
            else:
                break
k=0
for i in range(50,100):
    for j in range(100):
        if (i*j)%2 ==1:
            if k<B-1:
                C[i][j]=0
                k+=1
            else:
                break
print(100,100)
for i in range(100):
    st=""
    for j in range(100):
        if C[i][j]==0:
            st+="#"
        else:
            st+="."
    print(st)
a, b, c, d = map(int, input().split())
lcm_num = c*d / math.gcd(c, d)

def f(x):
    return x - x//c - x//d + x//lcm_num

print(f(b) - f(a-1))

### FIXED CODE ###

import fractions

def f(x, c, d):
    lcm_num = c*d // fractions.gcd(c, d)
    return x - x//c - x//d + x//lcm_num

a, b, c, d = map(int, input().split())
print(int(f(b, c, d) - f(a-1, c, d)))
n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

print(min(costs))


### FIXED CODE ###

n = int(input())
xy = set(tuple(map(int, input().split())) for _ in range(n))

costs = []
for a in xy:
    besides_a = xy - {a}
    for b in besides_a:
        p = b[0] - a[0]
        q = b[1] - a[1]
        arrow_num = 0
        for c in xy:
            if (c[0] + p, c[1] + q) in xy:
                arrow_num += 1
        cost = n - arrow_num
        costs.append(cost)

if n == 1:
    print(1)
else:
    print(min(costs))
M=input()


if M.count(M[0])+ M.count(M[1])+ M.count(M[2])+ M.count(M[3])=8:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

M=input()


if M.count(M[0])+ M.count(M[1])+ M.count(M[2])+ M.count(M[3])==8:
  print("Yes")
else:
  print("No")
h,n=map(int,input().split())dp=[10**10 for i in range(h+1)]
dp[0]=0
for i in range(n):
    x,y=map(int,input().split())
    for j in range(h+1):
        nj=min(h,j+x)
        dp[nj]=min(dp[nj],dp[j]+y)
print(dp[h])

### FIXED CODE ###

h,n=map(int,input().split())
a=[0]
b=[0]
width=2*10**4+7
dp=[[10**10 for i in range(width)] for j in range(n+1)]
dp[0][0]=0
dp[1][0]=0
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
for i in range(1,n+1):
    for j in range(width):
        dp[i][j]=min(dp[i][j],dp[i-1][j])
        if(j+a[i]<width):
            dp[i][j+a[i]]=min(dp[i][j+a[i]],dp[i][j]+b[i])
print(min(dp[n][h:]))
N = int(input())
H = list(map(int, input().split())) + [100 for _ in range(100)]

# dp = [0] * N
# dp[1] = abs(H[1]-H[0])
#
# # loop
# for i in range(2, N):
#     dp[i] = min((dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i])))
#
# print(dp)
# print(dp[N-1])

dp = [0] * N
dp[1] = abs(H[1]-H[0])

# rec
def func(i):
    #print(f'i: {i}')
    if i >= N:
        return 0
    else:
        dp[i] = min((dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i])))
        func(i+1)

func(2)
#print(dp)
print(dp[N-1])

### FIXED CODE ###

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

dp = [0] * N
dp[1] = abs(H[1]-H[0])
for i in range(2, N):
    dp[i] = min((dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i])))

print(dp[N-1])
n = input()

S = map(int, raw_input().split())

q = input()

T = map(int, raw_input().split())

S.append(0)
cnt = 0
for j in range(q):
    left = 0
    right = n
    while left < right:
        mid = (left + right) / 2
        if S[mid] == T[j]:
            cnt = cnt + 1
        else if T[j] < S[mid]:
            right = mid
        else:
            left = mid + 1

### FIXED CODE ###

n = input()

S = map(int, raw_input().split())

q = input()

T = map(int, raw_input().split())

cnt = 0
for j in range(q):
    left = 0
    right = n
    while left < right:
        mid = (left + right) / 2
        if S[mid] == T[j]:
            cnt = cnt + 1
            break
        elif T[j] < S[mid]:
            right = mid
        else:
            left = mid + 1

print cnt
import sys


K, A, B = sys.stdin.readline().split(" ")
k = long(K)
a = long(A)
b = long(B)

if (b-a) >= 2:
	hitsteps = a - 1
	leftoversteps = k - hitsteps
	rem = (leftoversteps)%2
	assert(rem==1 or rem == 0)
	swaps = (leftoversteps-rem)/2
	multbiscuits = swaps * (b-a)
	print(int(multbiscuits+rem+a))
else:
	print(int(k+1))

### FIXED CODE ###

import sys

K, A, B = sys.stdin.readline().split(" ")
k = long(K)
a = long(A)
b = long(B)

if (b-a) >= 2:
	hitsteps = a - 1
	leftoversteps = k - hitsteps
	rem = (leftoversteps)%2
	swaps = (leftoversteps-rem)/2
	multbiscuits = swaps * (b-a)
	print(int(multbiscuits+rem+a))
else:
	print(int(k+1))
N,M = map(int,input().split())

a = list(map(int,input().split()))
res = sum(a)
dis = 0
a.sort(reverse=True)
i = 0
while 0 < M:
    dis += a[0] - a[0]//2
    a[0] //= 2
    M -= 1
    while a[i] < a[i+1] and M != 0:
        a[i+1],a[i] = a[i],a[i+1]
        i += 1
        if len(a) < i:break
    i = 0
print(res-dis-M)


### FIXED CODE ###

import heapq

N,M = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)
for _ in range(M):
    heapq.heappush(a,((heapq.heappop(a)*(-1))//2)*(-1))
print(abs(sum(a)))
S = input()

fr_half = int(S[0:2]) 
se_half = int(S[2::])

if se_half > 0 and se_half <= 12:
	if fr_half  > 0 and fr_half <= 12:
		print('AMBIGUOUS')
  	else:
		print('YYMM')
else:
	if fr_half  > 0 and fr_half <= 12:
		print('MMYY')
	else:
		print('NA')

### FIXED CODE ###

S = input()

fr_half = int(S[0:2]) 
se_half = int(S[2::])

if se_half > 0 and se_half <= 12:
  if fr_half  > 0 and fr_half <= 12:
    print('AMBIGUOUS')
  else:
    print('YYMM')
else:
  if fr_half  > 0 and fr_half <= 12:
    print('MMYY')
  else:
   	print('NA')
import sys
cnt = 1

while 1
	num=sys.stdin.readline().strip()
	if num == "0":
		break;
	print('Case {0}: {1}'.format(cnt, num))
	cnt+=1

### FIXED CODE ###

import sys
cnt = 1

while 1:
  num=sys.stdin.readline().strip()
  if num == "0":
    break
  print('Case {0}: {1}'.format(cnt, num))
  cnt+=1
def factrial(n):
    if n == 1:
        return 1
    else:
        return n * factrial(n - 1)

def combination(n, r):
    return factrial(n) // (factrial(n - r) * factrial(r))

x, y = map(int, input().split())
if (2 * x - y) % 3 != 0 or (2 * y - x) % 3 != 0:
    print(0)
# elif 2 * y - x < 0 or 2 * x - y < 0:
#     print(0)
else:
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    print(combination(total, horizontal))

### FIXED CODE ###

def multiple_of_n(x, y, n=3):
    return (x - y) % n == 0

def combination(g1, g2, inverse, n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min([r, n - r])
    return g1[n] * g2[r] * g2[n - r] % mod

def make_inv(mod, N):
    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((- inverse[mod % i] * (mod // i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    return g1, g2, inverse

mod = 10 ** 9 + 7

x, y = map(int, input().split())
if multiple_of_n(2 * x, y) and multiple_of_n(2 * y, x):
    vertical = (2 * y - x) // 3
    horizontal = (2 * x - y) // 3
    total = vertical + horizontal
    g1, g2, inverse = make_inv(mod, total)
    print(combination(g1, g2, inverse, total, horizontal, mod))
else:
    print(0)
import numpy as np

S = input()
N = len(S)
arr = np.zeros((N, N), dtype=np.int)
for n, s in enumerate(S):
    i = n
    j = n + (1 if s == 'R' else -1)
    arr[i, j] += 1
#mat = np.matrix(arr)
#print(*(np.ones(N, dtype=np.int) * (mat ** 10 ** 100)).tolist()[0])
print()


### FIXED CODE ###

import numpy as np
from scipy.sparse import csr_matrix

S = input()
N = len(S)
row = tuple(range(N))
col = [n + (1 if s == 'R' else -1) for n, s in enumerate(S)]
data = [1] * N
mat = csr_matrix((data, (row, col)), shape=(N, N))
print(*np.ones(N, dtype=np.int) * (mat ** 10 ** 100))
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)
        
def lcm(a,b):
    return int(a/gcd(a,b)*b)

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

res=1
for i in range(n):
    res = lcm(res,t[i])
    
print(res)

### FIXED CODE ###

n = int(raw_input())

def gcd(a,b):
    if a > b:
        a,b = b,a
    # a <= b
    while a > 0:
        a,b = b%a, a
    return b

def lcm(a,b):
    g = gcd(a,b)
    return a/g * b

x = 1
for i in range(n):
    ti = int(raw_input())
    x = lcm(x, ti)

print x
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

try:

    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<=md:
            p+=1
        if p==n: break
        cnt+=n-p
        ans+=a[i]*(n-p)*2
except:
    ans=0

ans+=(m-cnt)*md
print(ans)


### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
s = input()
t = input()
start, end = 0, len(t)
def f(s, t, start, end):
    min_changes = len(t)
    if start + len(t) == len(s):
        count = 0
        for i in range(len(t)):
            if s[start:end][i] != t[i]: count += 1
        return min(count, min_changes)
    return f(s, t, start+1, end+1)

print(f(s, t, start, end))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
s = input()
t = input()
start, end = 0, len(t)
def f(s, t, start, end):
    min_changes = len(t)
    count = 0
    for i in range(len(t)):
        if s[start:end][i] != t[i]: count += 1
    if start + len(t) == len(s): return min(count, min_changes)
    else: return min(count, f(s, t, start+1, end+1))

print(f(s, t, start, end))
import functools

mod = 1e9 + 7
n = int(input())
fact = [1] * (n+1)

for i in range(2, n+1):
    for j in range(2, 32):
        if i == 0:
            break
        while True:
            if i % j == 0:
                i /= j
                fact[j] += 1
            else:
                break
    if i != 0:
        fact[int(i)] += 1

print(int(functools.reduce(lambda x, y: (x * y) % mod, fact[2:])))


### FIXED CODE ###

import sys
import functools

mod = 1e9 + 7
n = int(input())
if n == 1:
    print(1)
    sys.exit()

fact = [1] * (n+1)

for i in range(2, n+1):
    for j in range(2, 32):
        if i == 0:
            break
        while True:
            if i % j == 0:
                i /= j
                fact[j] += 1
            else:
                break
    if i != 0:
        fact[int(i)] += 1

print(int(functools.reduce(lambda x, y: (x * y) % mod, fact[2:])))
# ABC 155 C
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)
 
uni = np.unique(S) # return_counts is not available in numpy 1.8.2
uni = np.unique(S) 
count = np.zeros(len(uni))
for i,element in enumerate(uni):
    count[i] = (S==element).sum()
    
max_list = np.argwhere(count==np.max(count))
for index in max_list:
    print(str(uni[index][0]))

### FIXED CODE ###

# ABC 155 C
from collections import Counter
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)

count = Counter(S)
max_num = max(count.values())
max_list = [i for i,j in count.items() if j==max_num]

max_list.sort()
print('\n'.join(max_list))
input X as int
if X >= 30:
  return 'Yes'
else:
  return'No'

### FIXED CODE ###

X = int(input())
if(X >= 30):
  print('Yes')
else:
  print('No')
a, b = map(int,input().sprit())
print((a-1)*(b-1))

### FIXED CODE ###

a, b = map(int,input().split())
print((a-1)*(b-1))