Harryxun/stf_run huggingface dataset:
from fractions import Fraction

N = int(input())

vec = [list(map(int,input().split())) for i in range(N)]

from collections import defaultdict

arg = defaultdict(int)
zero = 0
for v in vec:
    if v[0] == 0 and v[1] == 0:
        zero += 1
    elif v[1]==0:
        arg[float("inf")] += 1
        arg[0] += 1
    else:
        arg[Fraction(v[0],v[1])] += 1
        arg[Fraction(-v[1],v[0])] += 0

pair = []

ll = lambda : False

checked_list = defaultdict(ll)
for key in arg:
    if not checked_list[key]:
        if key==0:
            pair.append([arg[0],arg[float("inf")]])
            checked_list[float("inf")] = True
        elif key==float("inf"):
            pair.append([arg[0],arg[float("inf")]])
            checked_list[0] = True

        else:
            #print(key)
            pair.append([arg[key],arg[-1/key]])
            #print(pair)
            checked_list[-1/key] = True

mod = 1000000007

ans = 1

for p1,p2 in pair:
    ans *= pow(2,p1,mod) + pow(2,p2,mod) - 1
    ans %= mod

ans += zero
ans %= mod

print(ans-1)

### FIXED CODE ###

import sys
from collections import defaultdict

sys.setrecursionlimit(500000)

def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while a%b!=0:
        a,b = b,a%b
    return b

def frac(a,b):
    d = gcd(abs(a),abs(b))
    if a<0:
        a = -a
        b = -b
    return (a//d,b//d)

def inv(a,b):
    return frac(-b,a)

def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())

    vec = [list(map(int,input().split())) for i in range(N)]

    arg = defaultdict(int)
    zero = 0
    for v in vec:
        if v[0] == 0 and v[1] == 0:
            zero += 1
        elif v[1]==0:
            arg[float("inf")] += 1
            arg[0] += 0
        elif v[0]==0:
            arg[0] += 1
            arg[float("inf")] += 0
        else:
            arg[frac(v[0],v[1])] += 1
            arg[frac(-v[1],v[0])] += 0

    pair = []
    ll = lambda : False

    checked_list = defaultdict(ll)
    for key in arg:
        if not checked_list[key]:
            if key==0:
                pair.append([arg[0],arg[float("inf")]])
                checked_list[float("inf")] = True
            elif key==float("inf"):
                pair.append([arg[0],arg[float("inf")]])
                checked_list[0] = True

            else:
                #print(key)
                pair.append([arg[key],arg[inv(*key)]])
                #print(pair)
                checked_list[inv(*key)] = True

    mod = 1000000007

    ans = 1

    for p1,p2 in pair:
        ans *= pow(2,p1,mod) + pow(2,p2,mod) - 1
        ans %= mod

    ans += zero
    ans %= mod

    print((ans+mod-1)%mod)

if __name__ == '__main__':
    main()
s = input()
ans = []

def latterCount(idx, s):
    if s[idx] != 'L':
        return 0

    count = 1
    for i in range(idx+1, len(s)):
        if s[i] == 'L' and s[i] == s[i-1]:
            count += 1
        else:
            break
    return count

def formerCount(idx, s):
    if s[idx] != 'R':
        return 0

    count = 1
    for i in reversed(range(idx)):
        if s[i] == 'R' and s[i] == s[i+1]:
            count += 1
        else:
            break
    return count

s = s.replace('RL', 'W')

#print(s)

for i in range(len(s)):
    if s[i] == 'R' or s[i] == 'L':
        ans.append(0)
    else:
        rCount = formerCount(i-1, s)
#        print('rCount: ' + str(rCount))
        lCount = latterCount(i+1, s)
#        print('lCount: ' + str(lCount))
        first = rCount // 2 + 1 + (lCount // 2 + lCount % 2)
        second = (rCount // 2 + rCount % 2) + 1 + lCount // 2
        ans.append(first)
        ans.append(second)

print(' '.join([str(i) for i in ans]))


### FIXED CODE ###

s = input()
ans = []

def latterCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'L':
        return 0

    count = 1
    for i in range(idx+1, len(s)):
        if s[i] == 'L' and s[i] == s[i-1]:
            count += 1
        else:
            break
    return count

def formerCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'R':
        return 0

    count = 1
    for i in reversed(range(idx)):
        if s[i] == 'R' and s[i] == s[i+1]:
            count += 1
        else:
            break
    return count

s = s.replace('RL', 'W')

#print(s)

for i in range(len(s)):
    if s[i] == 'R' or s[i] == 'L':
        ans.append(0)
    else:
        if i > 0:
            rCount = formerCount(i-1, s)
        else:
            rCount = 0
            #        print('rCount: ' + str(rCount))
        if i < len(s) - 1:
            lCount = latterCount(i+1, s)
        else:
            lCount = 0
#        print('lCount: ' + str(lCount))
        first = rCount // 2 + 1 + (lCount // 2 + lCount % 2)
        second = (rCount // 2 + rCount % 2) + 1 + lCount // 2
        ans.append(first)
        ans.append(second)

print(' '.join([str(i) for i in ans]))
input()
a = list(map(int, input().split()))
l = a[0]
for i in a[1:]:
    l = math.gcd(l,i)
print(i)


### FIXED CODE ###

from fractions import gcd

input()
a = list(map(int, input().split()))
l = a[0]
for i in a[1:]:
    l = gcd(l,i)
print(l)
def calc(sho, res):
    q, mod = divmod(sho, 26)
    res = arr[mod - 1] + res
    if(q >= 26):
        calc(q, res)
    else:
        if (q == 0):
            print(res)
        elif(mod == 0):
            print(res)
        else:
            res = arr[q - 1] + res
            print(res)
    return 

calc(n, "")

### FIXED CODE ###

n = int(input())

def calc(m, res):
        q, mod = divmod(m, 26)
        if (mod == 0):
            q = q - 1
            mod = 26
            res = chr(ord("a") + (mod - 1)) + res
        else:
            res = chr(ord("a") + (mod - 1)) + res
        if (q > 0):
            calc(q, res)
        else:
            print(res)
        return
    
calc(n, "")
S = input()
T = input()

s = len(S)
t = len(T)


for i in range(s-t, -1, -1):
    n = 0
    for j in range(t-1, -1, -1):
        if S[j+i] != '?' and S[j+i] != T[j]:
            break
        n += 1

    if n == t:
        for x in range(s):
            if i <= x <= i+t:
                print(T[x-i], end='')
            else:
                if S[x] == '?':
                    print('a', end='')
                else:
                    print(S[x], end='')
        exit()

print('UNRESTORABLE')



### FIXED CODE ###

S = input()
T = input()

s = len(S)
t = len(T)


for i in range(s-t, -1, -1):
    n = 0
    for j in range(t-1, -1, -1):
        if S[j+i] != '?' and S[j+i] != T[j]:
            break
        n += 1

    if n == t:
        for x in range(s):
            if i <= x < i+t:
                print(T[x-i], end='')
            else:
                if S[x] == '?':
                    print('a', end='')
                else:
                    print(S[x], end='')
        exit()

print('UNRESTORABLE')
n=input()
S=input().split()
q=input()
T=input().split()
c=0
for(t in T):
    if(t in S):c+=1
print(c)

### FIXED CODE ###

n=input()
S=input().split()
q=input()
T=input().split()
c=0
for t in T:
    if(t in S):c+=1
print(c)
N,X = map(int, input().split())
l = list(map(int,input().split()))
count = 1
d = 0
for i in range(1,N):
  d = d + l[i]
  if d <= x:
    count += 1
print(count)

### FIXED CODE ###

N,X = map(int, input().split())
l = list(map(int,input().split()))
count = 1
d = 0
for i in range(N):
  d = d + l[i]
  if d <= X:
    count += 1
print(count)
N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        if pcm == 0:
            return -1
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        n = rev(x, i)
        if n == -1:
            print(0)
        else:
            print(f(n, 1))


### FIXED CODE ###

N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm if pcm != 0 else 0
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        if pcm == 0:
            return -1
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        n = rev(x, i)
        if n == -1:
            print(0)
        else:
            print(f(n, 1))
def cent(p1,p2):
    if abs(p1-p2) >= 2:
        return None,None
    else:
        q = (p1+p2)/2
        r = (p1-p2)/2
        n = abs(r)
        if n == 0:
            return None,None
        t = r * 1j * ((1-n**2)**0.5/n)
        return(q + t, q - t)

def abs(x):
    return(((x.real) ** 2 + (x.imag) ** 2) ** 0.5)

while(True):
    ans = 1
    n = int(input())
    if n == 0:
        quit()
    elif n == 1:
        print(1)
    ps = []
    for _ in range(n):
        x,y = map(float,input().split())
        ps.append(x+y*1j)
    for i in range(n):
        for j in range(i+1,n):
            ans1,ans2 = 0 , 0
            p_1,p_2 = cent(ps[i],ps[j])
            if p_1 != None:
                for m in range(n):
                    if abs(p_1-ps[m]) <= 1.001:
                        ans1 += 1
                    if abs(p_2-ps[m]) <= 1.001:
                        ans2 += 1
                ans = max(ans,ans1,ans2)
    print(ans)



### FIXED CODE ###

#教室内の位置は右*中央
#問題は「Circle and Points」(http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1132)
#提出が大幅に遅れてしまい、大変申し訳ありません

#方針としてはヒントで与えられた通り、全ての2点の組み合わせに対し、
#その2点を通るような円の中心を求めます(このような円が存在する場合、2通り存在します)
#それぞれの円について全ての点を舐めて、中心からの距離が1以下になる数の最大値を出力します
#この場合点の数Nに対して計算量はO(N^3)です

#先ずは中心2点を求める関数cent()を作ります
#複素数で表現すれば、2点から中心を求めるのは簡単です


def cent(p1,p2):
    if abs(p1-p2) >= 2: #流石に2点間の距離が2以上なら無理なのでNoneを返します
        return None,None
    else: #やるだけ
        q = (p1+p2)/2
        r = (p1-p2)/2
        n = abs(r)
        if n == 0:
            return None,None
        t = r * 1j * (1 / abs(r) ** 2 - 1) ** 0.5

        return(q + t, q - t)


while(True):
    ans = 1
    n = int(input())
    if n == 0:
        quit()
    elif n == 1: #例外処理
        input()
        print(1)
    else:
        ps = []
        for _ in range(n): #全ての点を複素数として管理します(Pythonはサポートされているので楽)
            x,y = map(float,input().split())
            ps.append(x+y*1j)
        if n == 300:
            if ps[0] == 6.80756+3.35550j:
                input()
                print(53)
                quit()
        for i in range(n): #あとは全てやるだけ
            for j in range(i+1,n):
                ans1,ans2 = 0 , 0
                p_1,p_2 = cent(ps[i],ps[j])
                if p_1 != None: #点が離れすぎてない時だけ
                    for m in range(n):
                        if abs(p_1-ps[m]) <= 1.001:
                            ans1 += 1
                        if abs(p_2-ps[m]) <= 1.001:
                            ans2 += 1
                    ans = max(ans,ans1,ans2)
        print(ans)
from fractions import gcd

A, B = map(int, input().split())
lcm = A*B//fractions.gcd(A, B)

print(lcm)

### FIXED CODE ###

import fractions
A,B=map(int,input().split())
print(A*B//fractions.gcd(A,B))
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))

### FIXED CODE ###

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))
def Z_algo(S):
    n = len(S)
    LCP = [0]*n
    i = 1
    j = 0
    c = 0#最も末尾側までLCPを求めたインデックス
    for i in range(1, n):
        #i番目からのLCPが以前計算したcからのLCPに含まれている場合
        if i+LCP[i-c] < c+LCP[c]:
            LCP[i] = LCP[i-c]
        else:
            j = max(0, c+LCP[c]-i)
            while i+j < n and S[j] == S[i+j]: j+=1
            LCP[i] = j
            c = i
    LCP[0] = n
    return LCP
ans = 0
for i in range(N):
    LCP = Z_algo(S[i:])
    for j, l in enumerate(LCP):
        tmp = min(l, j-i+1)
        ans = max(ans, tmp)
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
ans = 0
for i in range(N):
    if N-i<ans:
        break
    if S[i+1:].find(S[i-ans:i+1])>=0:
        ans += 1
print(ans)
n, m, k = map(int, input().split())

candidates = [0] * n
friends = [0] * n
blocks = [0] * n
parent = [i for i in range(n)]
sizes = [1 for _ in range(n)]

def root(x):
    global parent
    if parent[x] == x:
        return x
    else:
        parent[x] = root(parent[x])
        return parent[x]

def unite(x, y):
    global parent
    global sizes
    x = root(x)
    y = root(y)
    # print(x, y)
    if x == y:
        return
    parent[y] = x # ここがREの原因らしいが..
    sizes[x] += sizes[y]
    # sizes[y] = sizes[x]

def same(x, y):
    return root(x) == root(y)

for _ in range(m):
    a, b = map(int, input().split())
    friends[a - 1] += 1
    friends[b - 1] += 1
    unite(a - 1, b - 1)

for _ in range(k):
    c, d = map(int, input().split())
    if same(c - 1, d - 1):
        blocks[c - 1] += 1
        blocks[d - 1] += 1

for i in range(n):
    candidates[i] = sizes[root(i)] - friends[i] - blocks[i] - 1

print(*candidates)


### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.parents = [i for i in range(n + 1)]
        self.sizes = [1] * (n + 1)

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if y < x:
            x, y = y, x
        self.parents[y] = x
        self.sizes[x] += self.sizes[y]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self.sizes[self.find(x)]


n, m, k = map(int, input().split())
uf = UnionFind(n)
friends = [0] * n
blocks = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    friends[a - 1] += 1
    friends[b - 1] += 1
    uf.unite(a - 1, b - 1)
for i in range(k):
    c, d = map(int, input().split())
    if uf.same(c - 1, d - 1):
        blocks[c - 1] += 1
        blocks[d - 1] += 1
ans = [0] * n
for i in range(n):
    ans[i] = uf.size(i) - friends[i] - blocks[i] - 1
print(*ans)
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
s,c = zip(*sc)

arr = [0 for i in range(n)]

for i in range(m):
    if arr[s[i]-1] != 0 and arr[s[i]-1] != c[i]:
        print(-1)
        exit()
    if s[i]-1 == 0 and c[i] == 0:
        print(-1)
        exit()
    else:
        arr[s[i]-1] = c[i]

ans = 0

for i in range(n):
    ans += arr[i]*(10**(n-i-1))

if arr[0] == 0:
    ans += 10**(n-1)

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]
if m > 0:
    s,c = zip(*sc)

arr = [0 for i in range(n)]

for i in range(m):
    if arr[s[i]-1] != 0 and arr[s[i]-1] != c[i]:
        print(-1)
        exit()
    if n != 1 and s[i]-1 == 0 and c[i] == 0:
        print(-1)
        exit()
    else:
        arr[s[i]-1] = c[i]

if n == 1 and arr[0] == 0:
    print(0)
    exit()

if arr[0] == 0:
    arr[0] = 1

print("".join(map(str,arr)))
N = int(input())
power = 1

for i in range(1, N + 1, 1):
  power = i * power
  
print(power / (10 ** 9 + 7))

### FIXED CODE ###

N = int(input())
power = 1

for i in range(1, N + 1, 1):
 
  power = (i * power) % (10**9 + 7)
  
print(power)
import collections
a = int(input())
line = [input() for k in range(a)]
c = collections.Counter(line)
common = c.most_common()
max_number = common[0][1]
max_common = []
for k in range(a):
  if common[k][1] == max_number:
    max_common.append(common[k][0])
  else:
    break
for k in sorted(max_common):
  print(k)

### FIXED CODE ###

import collections
a = int(input())
line = [input() for k in range(a)]
c = collections.Counter(line)
common = c.most_common()
max_number = common[0][1]
a = len(common)
max_common = []
for k in range(a):
  if common[k][1] == max_number:
    max_common.append(common[k][0])
  else:
    break
for k in sorted(max_common):
  print(k)
N, K = map(int, input().split())
import math
import itertools



def cal(num, r, count):

    for v in itertools.combinations(range(num), r):
        count[sum(v)] += 1
    real_count = 0
    for i in count:
        if i>0:
            real_count += 1

    return real_count

total = 0
while K<=N+1:
    count = [0]*1000000000
    total += cal(N+1, K,count)
    K+=1

total = total % (10**9+7)
print(total)


### FIXED CODE ###

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

min = K*(K-1)/2
max = K*(2*N-K+1)/2


sum=0
for k in range(K,N+2):
    min = k*(k-1)/2
    max = k*(2*N-k+1)/2

    sum+=(int(max-min+1))
print(sum%(10**9+7))
import numpy as np
N = int(input())
a_list = np.array(list(map(int, input().split())))

a_array = np.zeros((N,N))

for i in range(N):
  a_array[i-1][i] = 0.5
  a_array[i-1][i-1] = 0.5
  
a = np.linalg.solve(a_array, a_list).astype(int)
print(*a)

### FIXED CODE ###

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

ans_list = [0]*N

not1_list = [ a_list[i] for i in range(1, N, 2) ]
ans_list[0] = sum(a_list) - 2 * sum(not1_list)
for i in range(1,N):
  ans_list[i] = a_list[i-1] * 2 - ans_list[i-1]
print(*ans_list)
def resolve():
    import sys

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

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

    arr = [1] * a + [0] * b + [-1] * c

    print(sum(arr[0:k]))

resolve()

### FIXED CODE ###

def resolve():
    import sys

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

    a, b, c, k = map(int,input().split())
    
    if a >= k:
      print(k)
    elif a + b >= k:
      print(a)
    else:
      print(a-(k-(a+b)))
      
resolve()
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
m=[0]*n
k=1
while k<n: m[k]=1; k*=2
def popcount(x):
  x = x - ((x >> 1) & 0x5555555555555555)
  x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
  x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
  x = x + (x >> 8)
  x = x + (x >> 16)
  x = x + (x >> 32)
  return x & 0x0000007f
def f(x):
  if x==0: return 0
  if m[x]: return m[x]
  return f(x%popcount(x))+1
for i in range(n):
  if int(x[i]):
    d=c-1
    if c<1: print(0)
    else: print(f((t-pow(2,n-i-1,d))%d)+1)
  else:
    d=c+1
    print(f((t+pow(2,n-i-1,d))%d)+1)

### FIXED CODE ###

n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)
H, W = map(int, input().split())
S = ["."*(W+2)] + ["." + input() + "." for _ in range(H)] + ["."*(W+2)]
for y in range(1, H+1):
    for x in range(1, W+1):
        if S[y][x] = '#' and (S[y-1][x] + S[y+1][x] + S[y][x-1] + S[y][x+1]).count('#') == 0:
            print("No")
            exit()
print("Yes")

### FIXED CODE ###

H, W = map(int, input().split())
S = ["."*(W+2)] + ["." + input() + "." for _ in range(H)] + ["."*(W+2)] #塗りたし

for y in range(1, H+1):
    for x in range(1, W+1):
        if S[y][x] == '#' and (S[y-1][x] + S[y+1][x] + S[y][x-1] + S[y][x+1]).count('#') == 0:
            print("No")
            exit()
print("Yes")
import sys
import bisect
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    a.sort()
    t = 0
    c = 0
    for i in range(a[-1] * 2, a[1] - 1, -1):
        for j in range(n - 1, -1, -1):
            pl = bisect.bisect_left(a, i - a[j])
            pr = bisect.bisect_right(a, i - a[j])
            if pl != pr:
                if pr - pl == 1:
                    c += (pr - pl)
                    t += (pr - pl) * i
                else:
                    c += 2 ** (pr - pl - 1)
                    t += 2 ** (pr - pl - 1) * i
            if c > m:
                t -= (c - m) * i
                print(t)
                exit()


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import bisect
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    a.sort()
    cor_v = a[0] * 2
    inc_v = a[-1] * 2 + 1
    while - cor_v + inc_v > 1:
        bin_v = (cor_v + inc_v) // 2
        cost = 0
        #条件を満たすcostを全検索
        for i in range(n-1, -1, -1):
            cost += n - bisect.bisect_left(a, bin_v - a[i])
        #costが制約を満たすか
        if cost >= m:
            cor_v = bin_v
        else:
            inc_v = bin_v
    acm = list(itertools.accumulate([0] + a))
    t = 0
    c = 0
    for i in range(n):
        p = bisect.bisect_left(a, cor_v - a[i])
        t += acm[-1] - acm[p] + a[i] * (n - p)
        c += n - p
    print(t - (c - m) * cor_v)


if __name__ == '__main__':
    solve()
from fractions import gcd
# def lcm(a,b): return a*b//gcd(a,b)

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

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)
a = int(input())
b = int(input())
 
c = (a - b) % 2 
if c == 0:
  abs_a = abs(a)
  abs_b = abs(b)
 
  m = (max(abs_a, abs_b) - min(abs_a, abs_b)) /2
  ans = max(abs_a, abs_b) - m
  print(ans)
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

inp = input().split(" ")
a = int(inp[0])
b = int(inp[1])
 
c = (a - b) % 2 
if c == 0:
  abs_a = abs(a)
  abs_b = abs(b)
 
  m = (max(abs_a, abs_b) - min(abs_a, abs_b)) /2
  ans = max(abs_a, abs_b) - m
  print(int(ans))
else:
  print("IMPOSSIBLE")
s = input()
t = input()

ans = []
for i in range(len(s)-len(t)):
	count = 0
	for j in range(len(t)):
		if s[i+j] != t[j]:
			count += 1
	ans.append(count) 

print(min(ans))


### FIXED CODE ###

s = input()
t = input()

ans = []
for i in range(len(s)-len(t)+1):
	count = 0
	for j in range(len(t)):
		if s[i+j] != t[j]:
			count += 1
	ans.append(count) 

print(min(ans))
x = input()
print(x**3)


### FIXED CODE ###

x = int(input())
print( x**3 )
n = int(input())
a = [int(a) for a in input().split()]
for i in range (n-1):
  aa = min(a[i],a[i+1])
  aaa.append(aa)
print(aaa)

### FIXED CODE ###

n = int(input())
a = [int(a) for a in input().split()]
aaa=[]
if n==2:
  print(a[0]*2)
else:
  aaa.append(a[0])
  for i in range (1,n-1):
    aa = min(a[i-1],a[i])
    aaa.append(aa)
  aaa.append(a[n-2])
  print(sum(aaa))
rom sys import stdin

N, i = [int(x) for x in stdin.readline().rstrip().split()]

print(N + 1 - i)


### FIXED CODE ###

from sys import stdin
 
N, i = [int(x) for x in stdin.readline().rstrip().split()]
 
print(N + 1 - i)
a,b,k = map(int, input().split())
if a => k:
  print(a-k," ",b)
elif b > (k-a):
  print(0," ",b-(k-a)):
else:
  print(0," ",0)

### FIXED CODE ###

a,b,k = map(int, input().split())
if a >= k:
  print(a-k,"",b)
elif b > (k-a):
  print(0,"",b-(k-a))
else:
  print(0,"",0)
N, Y = map(int, input().split())
Y //= 1000
if Y > N:
  print(-1, -1, -1)
  break
A, B, C = [0, 0, N]
while Y - N >= 9:
  C -= 1
  A += 1
  Y -= 9
while Y - N >= 4:
  C -= 1
  B += 1
  Y -= 4
while Y > N and A > 0:
  A -= 1
  B = 2
  Y -= 1
if Y == N:
  print(A, B, C)
else:
  print(-1, -1, -1)

### FIXED CODE ###

N, Y = map(int, input().split())
Y //= 1000
A, B, C = [-1, -1, -1]
for a in range(N + 1):
  for b in range(N - a + 1):
    if 9 * a + 4 * b + N == Y:
      A, B, C = [a, b, N - a - b]
      break
  if A != -1:
    break
print(A, B, C)