Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
import numpy as np
ans = np.prod(A)

if 0 in A:
    print(ans)
    exit(0)
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以下なので、出力します
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,i))<=B:
    ans+=1
print(ans)    
      
  

### FIXED CODE ###

N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,str(i)))<=B:
    ans+=i
print(ans)
n = int(input())
m = 0
b = True
lis = map(long,input().split())
while(b):
  for index,l in enumrate(lis):
    if l % 2 == 1:
      b = False
      m -= 1
      break
    else:
      lis[index] = l // 2
  m += 1
print(m)

### FIXED CODE ###

n = int(input())
lis = list(map(int,input().split()))
m = 0
b = True
while(b):
  for index,l in enumerate(lis):
    if l % 2 == 1:
      b = False
      m -= 1
      break
    else:
      lis[index] = l / 2
  m += 1
print(m)
s=list(input())
print(s[0]+len(s-2)+s[-1])

### FIXED CODE ###

s=str(input())
print(s[0]+str(len(s)-2)+s[-1])
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [0] * M
y = [0] * M
c = [0] * M
for i in range(M):
    x[i], y[i], c[i] = map(int, input().split())

min_cost = min(a) + min(b)

for i in range(M):
    min_cost = min(a[x[i]-1] + b[x[i]-1] - c[i], min_cost)

print(min_cost)

### FIXED CODE ###

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

min_cost = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    min_cost = min(a[x-1] + b[y-1] - c, min_cost)

print(min_cost)
x, y, a, b, c = map(int, input().split())

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
r_idx = g_idx = 0
for idx in range(c):

    if r_idx >= x or g_idx >= y:
        break

    if r[idx] < p[r_idx] and r[idx] < q[g_idx]:
        break

    if r[idx] > p[r_idx] and r[idx] > q[g_idx]:
        if p[r_idx] < q[g_idx]:
            p[r_idx], r[idx] = r[idx], p[r_idx]
            r_idx += 1
        else:
            q[g_idx], r[idx] = r[idx], q[g_idx]
            g_idx += 1

    if r[idx] > p[r_idx]:
        p[r_idx], r[idx] = r[idx], p[r_idx]
        r_idx += 1

    if r[idx] > q[g_idx]:
        q[g_idx], r[idx] = r[idx], q[g_idx]
        g_idx += 1

print(sum(p) + sum(q))


### FIXED CODE ###

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

p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# step1: sort red/green apples in descending order
p.sort(reverse=True)
q.sort(reverse=True)

# step2:clip necessary apples
p = p[:x]
q = q[:y]

# step3: sort red/green apples in ascending order
p.sort()
q.sort()

# step4: sort non-color apples in descending order
r.sort(reverse=True)

# step5:swap apples to eliminate the least delicious apple
d = []

d.extend(p)
d.extend(q)
d.extend(r)
d.sort(reverse=True)

print(sum(d[: x + y]))
N,K = map(int,input().split())
mod = 10**9+7

def cul(N,K):
  Ans = 0
  for i in range(N+1-K+1):
    t = (K+i-1)*(K+i)/2
    Ans += (K+i)*N - 2*t +1
  return(int(Ans%mod))

print(cul(N,K))

### FIXED CODE ###

import math

a = int(input())
b = 2 * a * math.pi

print(str(b))
n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans))

### FIXED CODE ###

n = int(input())
lst = list(map(int, input().split()))
ans = [0]*n
ans[0] = lst[0]
for i in range(1, n):
  ans[i] = min(ans[i - 1], lst[i])
print(len(set(ans)))
#!/usr/bin/env python3
#A
import re

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

c = [list(map(str,input().split()))for i in range(a)]
d = [[0 for j in range(b)]  for i in range(a)]

for i in range(a):#初期のリスト設定
    for j in range(b):
        if c[i][0][j] == '#':
            d[i][j] = 1

def change(save,d):
    for i in save:
        d[i[0]][i[1]] = 1

count = 0
for k in range(a*b):
    save = []
    for i in range(a):
        for j in range(b):
            if d[i][j] == 1:
                if i != 0 and d[i-1][j] == 0:
                        save.append((i-1,j))
                if j != 0 and d[i][j-1] == 0:
                        save.append((i,j-1))
                if i != a-1 and d[i+1][j] == 0:
                        save.append((i+1,j))
                if j != b-1 and d[i][j+1] == 0:
                        save.append((i,j+1))

    change(save,d)
    if len(save) == 0:
        break;
    count += 1
print(count)

### FIXED CODE ###

#!/usr/bin/env python3
#AGC33 A

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
maze = [list(input()) for _ in range(h)]
check = [[True]*w for _ in range(h)]
dx,dy = [0,1,0,-1],[1,0,-1,0]
que = deque()
for i in range(h):
    for j in range(w):
        if maze[i][j] == '#':
            check[i][j] = False
            que.append((j,i))
res = 0
while que:
    que2 = deque(que)
    que = deque()
    flg = False
    while que2:
        x,y = que2.popleft()
        for i in range(4):
            nx,ny = x + dx[i], y + dy[i]
            if 0 <= nx < w and 0 <= ny < h:
                if check[ny][nx]:
                    check[ny][nx] = False
                    que.append((nx,ny))
                    flg = True
    if flg:
        res += 1
print(res)
N = int(input())
rabit = [ int(v) for v in input().split(" ") ]
skip = set()
num = 0
 
for i in range(N):
  n = rabit[i]
  if i in skip:
    continue
  if rabit[n-1] == i+1:
    skip.append(n-1)
    num += 1
 
print(num)

### FIXED CODE ###

N = int(input())
rabit = input().split(" ")
skip = []
num = 0

for i in range(N):
  n = int(rabit[i])
  if n < i+1:
    continue
  if int(rabit[n-1]) == i+1:
    num += 1

print(num)
a, b = int(input())
if (a+b)%2 == 0:
    print(abs(a+b)//2)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

a, b = map(int, input().split())
if (a+b)%2 == 0:
    print(abs(a+b)//2)
else:
    print("IMPOSSIBLE")
n = int(input())
k = int(input())
nums = list(map(int, input().split()))
a = []
for i in n:
  a.append(2 * min(k-nums[i], nums[i]))
print(min(a))
  

  

### FIXED CODE ###

n = int(input())
k = int(input())
nums = list(map(int, input().split()))
print(2 * sum([min(k - i, i) for i in nums]))
hoge = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]

X.sort()
Y.sort()

if(y[0]-X[-1]>0):
  print("No War")
else:
  print("War")

### FIXED CODE ###

hoge = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]
X.append(hoge[2])
Y.append(hoge[3])
X.sort()
Y.sort()
 

if(Y[0]-X[-1]>0):
  print("No War")
else:
  print("War")
d, t, s = list(map, int(input().split()))
if d / t <= s:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

d, t, s = list(map(int, input().split()))
if d / t <= s:
  print('Yes')
else:
  print('No')
N = int(input())
A = tuple(map(int,input().split()))

R = 0
L = tuple()
for i in range(N):
    if i == 0:
        L = (True,) * N
    else:
        L = (L[j] and A[j]^A[i+j] == A[j]+A[i+j] and L[j+1] for j in range(N-i)) + (False,) * i 
    R += sum(L)
    if sum(L) == 0:
        break
print(R)

### FIXED CODE ###

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

result = 0
Right = 0
tmp = 0
for left in range(N):
    for right in range(Right,N):
        if not (tmp & A[right]):
            tmp += A[right]
            Right = right + 1
        else:
            break
    tmp -= A[left]
    result += Right - left
print(result)
s = list(map(int, input().strip()))
t = list(map(int, input().strip()))
ans = 0
for i in range(3):
    if(s[i] == t[i]):
        ans += 1
print(ans)


### FIXED CODE ###

s1 = input()
s2 = input()
s1_list = list(s1)
s2_list = list(s2)
ans = 0
for i in range(3):
    if(s1_list[i] == s2_list[i]):
        ans += 1
print(ans)
if __name__=='__main__':
    N = int(input())
    S = input()
    ans = 'No'
    if N % 2 == 0:
        if S[0:N/2]==S[N/2:]: ans='Yes'
    print(ans)

### FIXED CODE ###

if __name__=='__main__':
    N = int(input())
    S = input()
    ans = 'No'
    if N % 2 == 0:
        if S[0:int(N/2)]==S[int(N/2):]: ans='Yes'
    print(ans)
n=int(input())
lst={}
 for i in range(n):
    lst[str(input())]+=1
print(len(lst))

### FIXED CODE ###

n=int(input())
lst={}
for i in range(n):
  lst[input()]=1
print(len(lst))
if input()=="22":
  print("Christmas Eve Eve Eve")
if input()=="23":
  print("Christmas Eve Eve")
if input()=="24":
  print("Christmas Eve")
if input()=="25":
  print("Christmas")

### FIXED CODE ###

d=input()
if d=="22":
	print("Christmas Eve Eve Eve")
if d=="23":
	print("Christmas Eve Eve")
if d=="24":
	print("Christmas Eve")
if d=="25":
	print("Christmas")
N=int(input())
X=int(input())
M=list(map(int,input().split()))
sum_M=sum(M)
min_M=min(M)
print((N-sum_M)//min_M+N)       

### FIXED CODE ###

N,X=map(int,input().split())
M=[int(input()) for i in range(N)]
print((X-sum(M))//min(M)+N)
import numpy as np

N, K = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]

K_str = format(K, 'b')
max_order = len(K_str)

B = np.array([list(format(a, '0{}b'.format(max_order)))
              for a in A]
             ).astype('i')[:, :max_order]
B = B.sum(axis=0)
B = np.where(B < N/2, 1, 0)

X_str = ''.join(map(str, B))
X = int(X_str, 2)

print(sum(map(lambda a: X ^ a, A)))

### FIXED CODE ###

T, X = map(int, input().split())

print(T / X)
def rem(x,r):
  if x <= 2*r:
    return -1
  ret = []
  for i in range(1,x):
    if x%i == r:
      ret.append([i])
    else:
      s = rem(x%i,r)
      if s == -1:
        continue
      else:
        for j in s:
          if j == -1:
            continue
          elif j[-1] < i:
            ret.append([i]+j)
          else:
            ret.append([i]+j)
  return ret
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for xx,yy in zip(x,y):
  if xx != yy and rem(xx,yy) == -1:
    print(-1)
    exit()
ls = [rem(xx,yy) if xx != yy else 0 for xx,yy in zip(x,y)]
mxls = [ls[i][0][0] if type(ls[i]) == list else 0 for i in range(n)]
mx = max(mxls)
ansst = set()
ansst.add(mx)
flg = [0]*n
while mx:
  for i in range(n):
    if x[i]%mx == y[i]:
      flg[i] = 1
      mxls[i] = 0
      continue
    r = rem(x[i]%mx,y[i])
    if r != -1 and r[0][0] <= mxls[i]:
      mxls[i] = r[0][0]
      x[i] %= mx
  mx = max(mxls)
  ansst.add(mx)
  if flg.count(1) == n:
    break
ans = -1
for b in ansst:
  ans += 2**b
print(ans)

### FIXED CODE ###

def rem(x,r):
  if (x,r) == (1,0):
    return [[1]]
  if x <= 2*r:
    return -1
  ret = []
  for i in range(1,x+1):
    if x%i == r:
      ret.append([i])
    else:
      s = rem(x%i,r)
      if s == -1:
        continue
      else:
        for j in s:
          if j == -1:
            continue
          elif j[-1] < i:
            ret.append([i]+j)
          else:
            ret.append([i]+j)
  return ret
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for xx,yy in zip(x,y):
  if xx != yy and rem(xx,yy) == -1:
    print(-1)
    exit()
ls = [rem(xx,yy) if xx != yy else 0 for xx,yy in zip(x,y)]
flg = [0]*n
def findmx(lsi,ansst,mx):
  ret = 100
  if lsi == 0:
    return 0
  for lsls in lsi:
    for j in lsls:
      if j > mx:
        return min(j,ret)
      elif j in ansst:
        continue
      else:
        ret = min(j,ret)
        break
    else:
      return 0
  else:
    return ret
    
mxls = [ls[i][0][0] if type(ls[i]) == list else 0 for i in range(n)]
mx = max(mxls)
ansst = set((mx,))
mxcand = mx
while mxcand:
  for i in range(n):
    t = findmx(ls[i],ansst,mx)
    mxls[i] = t
    if t == 0:
      flg[i] = 1
  mxcand = max(mxls)
  ansst.add(mxcand)
  if flg.count(1) == n:
    break
ans = 0
for b in ansst:
  if b:
    ans += 2**b
print(ans)
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions

t = stdin.readline().rstrip().split()
n = int(t[0])
k = int(t[1])
res = []
for el in range(k):
    tt = int(stdin.readline().rstrip())
    for el2 in range(tt):
        person = int(stdin.readline().rstrip())
        res.append(person)
count = 0
for el in range(1, n + 1):
    if not (el in res):
        count += 1
print(count)


### FIXED CODE ###

'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions

t = stdin.readline().rstrip().split()
n = int(t[0])
k = int(t[1])
res = []
for el in range(k):
    tt = int(stdin.readline().rstrip())
    person = [int(s) for s in stdin.readline().rstrip().split()]
    for el3 in person:
        res.append(el3)
count = 0
for el in range(1, n + 1):
    if not (el in res):
        count += 1
print(count)
n = int(input())

lcm = 0
gcd = 0

for i in range(n):
    t = int(input())
    if(i == 0):
        lcm, gcd = t, t
        continue
    lcm = t
    r = gcd % t
    while(r!=0):
        lcm = r
        r = t % r
    gcd *= t
    gcd //= lcm
print(gcd)


### FIXED CODE ###

n = input()
print("Yes" if(n[0]==n[2]) else "No")
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(M):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)
import numpy as np
H, W, M = map(int, input().split())
S = [[0]*W for _ in range(H)]
for _ in range(M):
  h, w = map(lambda x: int(x)-1, input().split())
  S[h][w] = 1

S = np.array(S)
T = np.array([[0]*W for _ in range(H)])
for i in range(H):
  T[i] += np.sum(S[i])

for i in range(W):
  T[:, i] += np.sum(S[:, i])

T -= S
print(np.max(T))

### FIXED CODE ###

ans=0

h,w,m=map(int,input().split())
d=list()
from collections import defaultdict
r=defaultdict(int)
c=defaultdict(int)
r=[0]*(h+1)
c=[0]*(w+1)
for i in range(m):
  a,b=map(int,input().split())
  d+=(a,b),
  r[a]+=1
  c[b]+=1
R=max(r)
C=max(c)

x=0
nr=r.count(R)
nc=c.count(C)
for i in range(m):
    a,b=d[i]
    if r[a]==R and c[b]==C:
        x+=1

ans=R+C
if x==nr*nc:
    ans-=1
print(ans)
# your code goes here
a, b = input().split(" ")
print ("%d %d %.5f" % (int(a)/int(b), int(a)%int(b), float(a)/int(b)))

### FIXED CODE ###

# your code goes here
import math

n = int(input())
for i in range(n):
	xa, ya, ra, xb, yb, rb = [float(x) for x in input().split(" ")]
	distance = math.sqrt((xb-xa)**2 + (yb-ya)**2)

	if distance > ra+rb:
		print(0)
	elif distance < abs(ra-rb):
		if ra > rb:
			print(2)
		elif ra < rb:
			print(-2)
		else:
			print(1)
	elif distance <= ra+rb:
		print(1)
a,b,x = map(int,input().split())
c =0
for i in range(a,b+1):
	if i % x == 0:
        c +=1
print(c)


### FIXED CODE ###

a,b,x=map(int,input().split())
B=b//x
A=a//x

print(B-A+ (a%x == 0))
s = input()
ans = [0]*(len(s)+1)

for i in range(len(s):
    if s[i] == '<':
        ans[i+1] = ans[i] + 1
for i in range(len(s)-1,-1,-1):
    if s[i] == '>':
        ans[i] = max(ans[i], ans[i+1] + 1)
print(sum(ans))


### FIXED CODE ###

s = input()
ans = [0]*(len(s)+1)

for i in range(len(s)):
    if s[i] == '<':
        ans[i+1] = ans[i] + 1
for i in range(len(s)-1,-1,-1):
    if s[i] == '>':
        ans[i] = max(ans[i], ans[i+1] + 1)
print(sum(ans))
N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
mod=10**9+7
score=1

if K%2==1:  #これでKは偶数として扱えるようになった
    score*=A[0]
    A.pop(0)
    K-=1

print(A)

P,M=[],[]
for i in A:
    if i>0:
        P.append(i)
    else:
        M.append(i)

M=M[::-1]
t=0
p,m=0,0
while t<=K:
    if score<0:  #負であることが確定しているなら小さくなるようにする
        P=P[::-1]
        M=M[::-1]
    if t+2<=K:
        if 2*p+1<len(P) and 2*m+1<len(M):
            if P[2*p]*P[2*p+1] >= M[2*m]*M[2*m+1]:
                score*=P[2*p]*P[2*p+1]
                p+=1
                t+=2
            else:
                score*=M[2*m]*M[2*m+1]
                m+=1
                t+=2
        elif 2*p+1<len(P):
            score*=P[2*p]*P[2*p+1]
            p+=1
            t+=2
        else:
            score*=M[2*m]*M[2*m+1]
            m+=1
            t+=2
    elif t+1<=K:
        if 2*p<len(P):
            score*=P[2*p]
        else:
            score*=M[2*m]
        break
    else:
        break
    score%=mod

print(score%mod)

### FIXED CODE ###

import sys

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
mod=10**9+7
score=1

if K%2==1:  #これでKは偶数として扱えるようになった
    score*=A[0]
    A.pop(0)
    K-=1

#print(A)

P,M=[],[]
for i in A:
    if i>0:
        P.append(i)
    else:
        M.append(i)

M=M[::-1]
t=0
p,m=0,0
while t<=K:
    if score<0:  #負であることが確定しているなら小さくなるようにする
        P=P[::-1]
        M=M[::-1]
        if 0 in M:
            print(0)
            sys.exit()
    if t+2<=K:
        if 2*p+1<len(P) and 2*m+1<len(M):
            if P[2*p]*P[2*p+1] >= M[2*m]*M[2*m+1]:
                score*=P[2*p]*P[2*p+1]
                p+=1
                t+=2
            else:
                score*=M[2*m]*M[2*m+1]
                m+=1
                t+=2
        elif 2*p+1<len(P):
            score*=P[2*p]*P[2*p+1]
            p+=1
            t+=2
        elif 2*m+1<len(M):
            score*=M[2*m]*M[2*m+1]
            m+=1
            t+=2
        else:  #?
            score*=P[-1]*M[-1]
            break
    elif t+1<=K:
        if 2*p<len(P):
            score*=P[2*p]
        else:
            score*=M[2*m]
        break
    else:
        break
    score%=mod

print(score%mod)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

N = int(input())
A = list(map(int, input().split()))
ANS = [0]*len(A)
sum=0
ansList = []
for i in range(len(A),0,-1):
    if(ANS[i-1]%2!=A[i-1]):
        tList = make_divisors(i)
        for j in tList:
            ANS[j-1]+=1
        ansList.append(i)
print(len(ansList))
for i in ansList:
    print(i, end=" ")


### FIXED CODE ###

N = int(input())
print(3*N*N)
r = int(input())
x = 3.141592653589793238462643383279
print('{:.7f}'.format(r * r * x), '{:.7f}'.format(2 * r * x))



### FIXED CODE ###

r = float(input())
x = 3.141592653589793238462643383279
print('{:.7f}'.format(r * r * x), '{:.7f}'.format(2 * r * x))
n,x = map(int,input().split())
a = list(map(int, input().split()))
b = [0]*(n-1)
for i in range(n-1):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)

### FIXED CODE ###

from fractions import gcd
n,x = map(int,input().split())
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
b = [0]*n
for i in range(n):
    b[i]= a[i+1]-a[i]
c = 0
for j in b:
    c = gcd(c, j)
print(c)
aa = list(map(int, input().split()))

bb = sorted(aa)

print(bb[0]+bb[1])

### FIXED CODE ###

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

bb = sorted(aa)

print(bb[0]+bb[1])
import sys

n,m=input().split()
N = int(n)
M = int(m)
X = input().split()
#MはXの要素の数
X = [int(x) for x in X]

X.sort()
if M == 1:
    print(0)
    sys.exit()
elif M < 1:
    sys.exit()

minus = [X[i]-X[i-1] for i in range(1,M)]
#print(minus)

minus.sort()
#print(minus)
sum_num = 0
if N < M:
    for i in range(N+1):
        sum_num += minus[i]
    print(sum_num)
elif N >= M:
    print(0)

### FIXED CODE ###

import sys

n,m=input().split()
N = int(n)
M = int(m)
X = input().split()
#MはXの要素の数
X = [int(x) for x in X]

X.sort()
if M == 1:
    print(0)
    sys.exit()
elif M < 1:
    sys.exit()

minus = [X[i]-X[i-1] for i in range(1,M)]
#print(minus)

minus.sort()
#print(minus)
sum_num = 0
if N < M:
    for i in range(M-N):
        sum_num += minus[i]
    print(sum_num)
elif N >= M:
    print(0)
A, B, C = map(int,input().split())
if B+C <=A {
  print(0)
}else{
C=B+C-A
  print(C)
}

### FIXED CODE ###

A, B, C = map(int,input().split())
if B+C <= A :
  print(0)
else:
  C = B+C-A
  print(C)
class UnionFind():
  def __init__(self, n):
    self.par = [i for i in range(n)]

  def root(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    self.par[y] = x

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

N, M = map(int, input().split())
uf = UnionFind(N)

for i in range(M):
  x, y, z = map(int, input().split())
  uf.unite(x-1, y-1)

ans = set()
for i in range(N):
  ans.add(uf.root(i))
print(len(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

class UnionFind():
  def __init__(self, n):
    self.par = [i for i in range(n)]

  def root(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  
  def unite(self, x, y):
    x = self.root(x)
    y = self.root(y)
    self.par[y] = x

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

N, M = map(int, input().split())
uf = UnionFind(N)

for i in range(M):
  x, y, z = map(int, input().split())
  uf.unite(x-1, y-1)

ans = set()
for i in range(N):
  ans.add(uf.root(i))
print(len(ans))
l = [int(input) for i range(4)]
if l[0] <= l[1]:
    sum = l[0] * l[2]
else:
    sum = l[1] * l[2] + (l[0]-l[1]) * l[3]
print(sum)

### FIXED CODE ###

l = [int(input()) for i in range(4)]
if l[0] <= l[1]:
    sum = l[0] * l[2]
else:
    sum = l[1] * l[2] + (l[0]-l[1]) * l[3]
print(sum)