Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [i for i in range(0, N + 1)]
size = [1] * (N + 1)

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
      return
    par[x] = y
    size[y] += size[x]
    size[x] = size[y]
    
def same(x, y):
    return root(x) == root(y)
    
    
inconv = N * (N - 1) // 2
inconvs = [inconv]
for A, B in ils[M + 1:0:-1]:
    if not same(A, B):
        inconv -= size[root(A)] * size[root(B)]
        unite(A, B)
    inconvs.insert(0, inconv)
    
for i in inconvs:
    print(i)

### FIXED CODE ###

N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [-1 for i in range(N)]

def root(x):
    if par[x] < 0:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if size(x) < size(y):
        x, y = y, x
    par[x] += par[y]
    par[y] = x
    
def same(x, y):
    return root(x) == root(y)

def size(x):
    return - par[root(x)]
    
    
inconv = N * (N - 1) // 2
result = [0] * M
for i in range(M - 1, -1, -1):
    A, B = ils[i]
    A -= 1
    B -= 1
    result[i] = inconv
    if not same(A, B):
        inconv -= size(A) * size(B)
        unite(A, B)
    
for i in result:
    print(i)
import numpy
n = int(input())
l = list(map(int,input().split()))
av = round(numpy.average(l))
sumsquare = 0
for i in l:
    sumsquare += (i - av)**2
print(sumsquare)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
min_sum = 10**9
for i in range(min(l),max(l)+1):
    min_sum = min(min_sum,sum([(j-i)**2 for j in l]))

print(min_sum)
n,k=map(int,input().split())
A=list(map(int,input().split()))

s=sum(A)
import math
def yakusu(n):
  ans_local=set()
  for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
      ans_local = ans_local | set([i,n//i]) #setなので平方数でもOK
  return list(ans_local)  #必要に応じてsort

yaku=sorted(yakusu(s), reverse=1)
#print(yaku)
for mod in yaku:
    B=[i%mod for i in A if i%mod!=0]
    B.sort()
    r=[B[0]]*len(B)
    for i in range(len(B)-1):
        r[i+1]= r[i]+B[i+1]
    now=float("INF")
    for i in range(1,len(B)): #切り方
        if r[i-1] ==  mod*(len(B)-i)-(r[-1]-r[i-1]) and r[i-1]<=k:
            print(mod);exit()

    


### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))

s=sum(A)
import math
def yakusu(n):
  ans_local=set()
  for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
      ans_local = ans_local | set([i,n//i]) #setなので平方数でもOK
  return list(ans_local)  #必要に応じてsort

yaku=sorted(yakusu(s), reverse=1)
#print(yaku)
for mod in yaku:
    B=[i%mod for i in A if i%mod!=0]
    if B==[] : print(mod);exit()
    if len(B)==1:
        q=B[0]
        if 0<=q<=k or mod-k<=q: print(mod);exit()
        else:continue
    B.sort()
    r=[B[0]]*len(B)
    for i in range(len(B)-1):
        r[i+1]= r[i]+B[i+1]
    now=float("INF")
    for i in range(1,len(B)): #切り方
        if r[i-1] ==  mod*(len(B)-i)-(r[-1]-r[i-1]) and r[i-1]<=k:
            print(mod);exit()
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0] * 10010 for _ in range(N+1)]
minw = min(w)
for i in range(N):
    w[i] -= minw
    w[i] += 1
for i in range(N):
    for j in range(10000):
        dp[i+1][j] = dp[i][j]
        if j-w[i] >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-w[i]]+v[i])

print(dp[N][min(W-minw,10000)])


### FIXED CODE ###

N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

minw = min(w)
for i in range(N):
    w[i] -= minw

ww = [[] for _ in range(4)]
for i, o in enumerate(w):
    ww[o].append(v[i])
for i in range(4):
    ww[i].sort(reverse=True)

ans = 0
for i in range(len(ww[0])+1):
    isum = sum(ww[0][:i])
    for j in range(len(ww[1])+1):
        jsum = sum(ww[1][:j])
        for k in range(len(ww[2])+1):
            ksum = sum(ww[2][:k])
            for t in range(len(ww[3])+1):
                tsum = sum(ww[3][:t])
                weight = minw * i + (minw+1) * j + (minw+2) * k + (minw+3) * t
                if weight <= W:
                    ans = max(ans, isum+jsum+ksum+tsum)
print(ans)
word1 = input()
word2 = input()

print(word1 + word2)

### FIXED CODE ###

word1, word2 = input().split()

print(word2 + word1)
import sys
def main():

n=int(input())
p=tuple(map(int,input().split()))
s=1
for i in range(n):
    s*=p[i]
if s>=10**18+1:
    print(-1)
    sys.exit()
print(s)

if __name__ == '__main__':
main()

### FIXED CODE ###

import sys
def main():

    n=int(input())
    p=list(map(int,input().split()))
    s=1
    p=sorted(p)
    for i in p:
        s*=i
        if i==0:
            print(0)
            sys.exit()
        elif s>=10**18+1:
            print(-1)
            sys.exit()
    print(s)

if __name__ == '__main__':
    main()
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]-1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range(len(B)):
        if B[i]!=2:
            print(0)
            exit()
    print(int(pow(2,N/2)%(pow(10,9)+7)))
else:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=N+1/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range(len(B)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    print(int(pow(2,(N-1)/2)%(pow(10,9)+7)))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
IndexCount=0
IndexRe=0
Divider=pow(10,9)+7
ans=1
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    IndexCount=int((N/2)//1000)
    IndexRe=int((N/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    IndexCount=int(((N-1)/2)//1000)
    IndexRe=int(((N-1)/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
else:
    print(0)
i=1
while input()!=0:
    x = int(input())
    print("Case {0}: {1}",format(i,x))
    i += 1


### FIXED CODE ###

i=1
while True:
    x = int(input())
    if x==0: break
    print("Case {0}: {1}".format(i,x))
    i += 1
n = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

A = [i+1 for i in range(N)]

from itertools import permutations

for i,per in enumerate(list(permutations(A))):
  if per == P:
    x = i
  if per == Q:
    y = i
  
print(abs(x-y))

### FIXED CODE ###

from itertools import permutations
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))

a = [i+1 for i in range(n)]
for i,per in enumerate(list(permutations(a))):
    if per == p:
        x = i
    if per == q:
        y = i
print(abs(x-y))
def main():
  N = int(input())
  A = list(map(int, input().split()))
  r = 1
  cnt = 1
  T = A[0]
  t = 1
  flg = False
  for l in range(N):
    while True:
      if T ^ A[r] == T + A[r]:
        t += 1
        cnt += t
        T += A[r]
        r += 1
      else:
        T -= A[l]
        t -= 1
        break
      if r == N:
        flg = True
        break
    if flg:
      break
  print(cnt)  

main()

### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split()))
if len(A) == 1:
  print(1)
  exit()
r = 1
cnt = 1
T = A[0]
t = 1
flg = False
for l in range(N):
  while True:
    if T ^ A[r] == T + A[r]:
      t += 1
      cnt += t
      T += A[r]
      r += 1
    else:
      T -= A[l]
      t -= 1
      break
    if r == N:
      flg = True
      break
  if flg:
    break
print(cnt)
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
q = []
for i in range(1, 101):
    if i in p:continue
    q.append(i)

import bisect
ind = bisect.bisect_left(q, x)
#print(ind)

temp1 = abs(q[ind - 1] - x)
temp2 = abs(q[ind] - x)
if temp1 <= temp2:print(q[ind - 1])
else:print(q[ind])

### FIXED CODE ###

x, n = map(int, input().split())
if n != 0:
    p = list(map(int, input().split()))
else:
    print(x)
    exit()

ABS = 10 ** 9
ans = 0
for i in range(102):
    if i in p:continue

    temp = abs(i - x)
    if ABS > temp:
        ABS = temp
        ans = i
print(ans)
#coding:utf-8

n,k = map(int,input().split())
ls = list(map(int,input().split()))
# n, k = 5, 3
# ls = [-30,-10,10,20,50]

# n,k = 3,2
# ls=[10,20,30]

# n,k = 1,1
# ls = [0]

#n,k=8,5
#ls=[-9,-7,-4,-3,1,2,3,4]

first = -1
for i,point in enumerate(ls):
    if point >= 0:
        first = i
        break
size=k+1
ans = []
for i in range(size):
    if first-size+i+1>=0 and first+i-1< len(ls):
        temp = [0,ls[first-size+i+1],ls[first+i-1]]
        temp = [abs(min(temp)),abs(max(temp))]
        ans.append((2*min(temp)+max(temp)))
print (min(ans))


### FIXED CODE ###

#coding:utf-8
import numpy as np
n,k = map(int,input().split())
ls = list(map(int,input().split()))

# n, k = 5, 3
# ls = [-30,-10,10,20,50]
#
# n,k = 3,2
# ls=[10,20,30]

# n,k = 1,1
# ls = [0]

# n,k=8,5
# ls=[-9,-7,-4,-3,1,2,3,4]
if not (0 in ls):
    ls.append(0)
    k+=1
#print (ls)

ls = np.array(ls)
ls.sort()
#print (ls)

idx = np.where(ls==0)[0][0]
#print (idx,k)
#print (idx+k)
start = max(0,idx-k)
goal = min(idx+k,len(ls)-1)

#print (start,goal)
answer = []
for i in range(goal-(k-1)+1):
    #print (i,i+k-1)
    mi = min(abs(ls[i]),abs(ls[i+k-1]))
    ma = max(abs(ls[i]),abs(ls[i+k-1]))
    #print (mi,ma)
    answer.append(2*mi+ma)
print (min(answer))
# def set_max(ls):
#     if len(ls)>0:
#         return set([max(ls)])
#     else:
#         return set()
# def set_min(ls):
#     if len(ls)>0:
#         return set([min(ls)])
#     else:
#         return set()
#
#
# plus = list(filter(lambda n:n>=0, ls))
# minus = list(filter(lambda n:n<=0, ls))
#
# neighbor = set_max(minus) | set_min(plus)
#
# #print (neighbor)
# answer = []
# cnt = 0
# for i in range(n-k+1):
#     if len(set(ls[i:i+k])&neighbor)>0:
#
#         #print (ls[i:i+k])
#         #print (np.sign(ls[i]*ls[i+k-1]))
#         temp = [abs(ls[i]),abs(ls[i+k-1])]
#         if np.sign(ls[i]*ls[i+k-1])<0:
#
#             answer.append(2*min(temp)+max(temp))
#         else:
#             answer.append(max(temp))
#         cnt += 1
#         if cnt == k + 1:
#             break
# print (min(answer))

# first = -1
# for i,point in enumerate(ls):
#     if point >= 0:
#         first = i
#         break
# size=k+1
# ans = []
# for i in range(size):
#     if first-size+i+1>=0 and first+i-1< len(ls):
#         temp = [0,ls[first-size+i+1],ls[first+i-1]]
#         temp = [abs(min(temp)),abs(max(temp))]
#         ans.append((2*min(temp)+max(temp)))
# print (min(ans))
c = input('')
if c = a:
    print('vowel')
elif c = e:
    print('vowel')
elif c = i:
    print('vowel')
elif c = o:
    print('vowel')
elif c = u:
    print('vowel')
else:
    print('consonant')

### FIXED CODE ###

c = input()
d =['a', 'e', 'i', 'o', 'u']

if c in d:
    print('vowel')
else:
    print('consonant')
import numpy as np

N = int(input())

ans = np.zeros((N, N))
A = np.arange(1, N + 1)

ans[0, :] = A
ans[1, :] = A[A%2 == 0]
ans[2, :] = A[A%3 == 0]
ans[3, :] = A[A%4 == 0]

print(np.sum(ans))

### FIXED CODE ###

import numpy as np

N = int(input())

ans = 0

for i in range(1, N+1):
	n = int(N/i)
	ans += n * (n + 1) / 2 * i

print(int(ans))
import heapq
import math


def solve(n, v):
    heapq.heapify(v)
    nn = math.ceil(n / 2)

    while len(nn) != 1:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return v[0]


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

print(solve(n, v))


### FIXED CODE ###

import heapq
import math


def solve(n, v):
    heapq.heapify(v)

    while len(v) != 1:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return v[0]


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

print(solve(n, v))
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  red = cmb(M+1,i)
  blue = cmb(K-1,i-1)
  print(red*blue%(10**9+7))


### FIXED CODE ###

from operator import mul
from functools import reduce
 
def cmb(n,r):
    r = min(n-r,r)
    if r==0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  if M+1<i:
    red = 0
  else:
    red = cmb(M+1,i)
  blue = cmb(K-1,i-1)
  print(red*blue%(10**9+7))
N = int(input())
test = list(map(int,input().split()))
M = int(input()) 
  
for _ in range(M):
  a,b = int(input()).split()
  test[a] = b
  print(sum(test))

### FIXED CODE ###

N = int(input())
test = list(map(int,input().split()))
M = int(input()) 
  
for _ in range(M):
  a,b = map(int,input().split())
  print(sum(test) - test[a-1] + b)
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

v = A[1:] - A[:-1]
# print(v)

cnt = 0
i = 0
while i <= len(v) - 1:
    # print('i', i)
    if v[i] * v[i + 1] < 0:
        cnt += 1
        i += 1
    i += 1
ans = cnt + 1
print(ans)

# 単調非減少 : v[i + 1] - v[i] >= 0
# 単調非増加 : v[i + 1] - v[i] <= 0
# 折り返し点 : v[i] * v[i + 1] < 0 and v[i + 1] * v[i + 2] < 0


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
d = 0
ans = 1
for i in range(1, N):
    if A[i - 1] < A[i]:
        if d < 0:
            ans += 1
            d = 0
        elif d == 0:
            d = 1
    elif A[i - 1] > A[i]:
        if d > 0:
            ans += 1
            d = 0
        elif d == 0:
            d = -1
print(ans)
n = int(input())
def get_h(pos,cx,cy,H):
  r= H - abs(pos[0]-cx) - abs(pos[1]-cy)
  return r

points = []
for i in range(n):
  x,y,h = map(int,input().split())
  points.append([x,y,h])
  
ans = []
if ans == []:
  for i in range(101):
    for j in range(101):
      d = get_h(points[0],i,j,0)- get_h(points[1],i,j,0)
      if points[0][2]- points[1][2] == d:
        ans.append([i,j])
for k in range(len(points)):
  for l in range(k+1,len(points)):
    for elem in ans[:]:
      i = elem[0]
      j = elem[1]
      if points[k][2] - points[l][2] != abs(points[l][0]-i) + abs(points[l][1]-j)- abs(points[k][0]-i)-abs(points[k][1]-j):
        ans.remove(elem)
h = abs(points[0][0]-ans[0][0])+abs(points[0][1]-ans[0][1]) + points[0][2]
print('{} {} {}'.format(ans[0][0],ans[0][1],h))

### FIXED CODE ###

n = int(input())
hist = [tuple(map(int,input().split())) for _ in range(n)]
hist.sort(key=lambda x: x[2], reverse=1)

cands = []
x0,y0,h0 = hist[0]

for i in range(0,101):
  for j in range(0,101):
    if h0 == 0:
      cands.append((i,j,1))
    else:
      cands.append((i,j, h0+abs(i-x0)+abs(j-y0)))
    
for X,Y,H in cands:
  for x,y,h in hist:
    if max(H-abs(X-x)-abs(Y-y),0) == h:
      continue
    else:
      break
  else:
    print(X,Y,H)
    break
def main():
    a,b = float, input().split()
    a = int(a)
    b = int(float(b)*100)
    print(a*b//100)
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    a,b = input().split()
    a = int(a)
    b = int(b.replace('.', ''))
    print(a*b//100)
if __name__ == "__main__":
    main()
X,T = map(int, input().split(' '))

print(f'{T/X/1.0}000')

### FIXED CODE ###

N = input()
L = list(map(int, input().split(' ')))

flg = 0
for l in L:
  if not sum(L)-l > l:
    print('No')
    flg = 1

if not flg: print('Yes')
n = input()
k = int(input())
import math
digit = math.floor(math.log10(int(n))) + 1
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]



### FIXED CODE ###

n = input()
k = int(input())
digit = len(n)
dp0 = [[0 for i in range(k+1)] for j in range(digit+1)]
dp1 = [[0 for i in range(k+1)] for j in range(digit+1)]

dp1[1][1] = 1
dp0[1][1] = int(n[0])-1
for i in range(1, digit+1):
    dp0[i][0] = 1

for i in range(2, digit+1):
    for j in range(1, k+1):
        num = int(n[i-1])
        if num == 0:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j]
            dp1[i][j] = dp1[i-1][j] 
        else:
            dp0[i][j] = dp0[i-1][j-1]*9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
            dp1[i][j] = dp1[i-1][j-1]

print(dp0[digit][k] + dp1[digit][k])
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]

c=0
for i in range(n-1):
  for j in range(i+1,n):
    c+=(sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer

print(c)

### FIXED CODE ###

n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]

c=0
for i in range(n-1):
  for j in range(i+1,n):
    c+=(sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer()

print(c)
import collections

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


a = collections.Counter(a)

a = a.most_common()
if k<len(a):
	x = 0
	for i in range(k,len(a)):
		x += a[i][1]

	print(x)
else:
	print(0)


### FIXED CODE ###

import collections

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


a = collections.Counter(a)

a = a.most_common()
if k<len(a):
	x = 0
	for i in range(k,len(a)):
		x += a[i][1]

	print(x)
else:
	print(0)
def one(x):
    if x == 1:
        ret = 14
        return ret
    else:
        ret = x
        return ret

a, b = map(int, int(input())
if one(a) > one(b):
    print("Alice")
elif one(a) < one(b):
    print("Bob")
else:
    print("Draw")


### FIXED CODE ###


def one(x):
    if x == 1:
        ret = 14
        return ret
    else:
        ret = x
        return ret

a, b = map(int, input().split())
if one(a) > one(b):
    print("Alice")
elif one(a) < one(b):
    print("Bob")
else:
    print("Draw")
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

nlist = [0] * (10**9+1)
for _ in range(N):
  i = int(input())
  nlist[i] = ~nlist[i]

print(nlist.count(~0))



### FIXED CODE ###

###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

nset = set()

for _ in range(N):
  i = int(input())
  if i in nset: nset.remove(i)
  else: nset.add(i)

print(len(nset))
l=map(int,raw_input().split())
c=l[0]*l[1]
if c%2==1:
  print('Odd')
else:
  print('Even')


### FIXED CODE ###

a, b=(int(i) for i in input().split())
c=a*b
if c%2==1:
  print('Odd')
else:
  print('Even')
a,b,c = input().split()
if b == "+":
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

### FIXED CODE ###

a,b,c = input().split()
if b == "+":
  print(int(a)+int(c))
else:
  print(int(a)-int(c))
# coding: utf-8
# Here your code !
import sys
import numpy

def calculate_standard_deviation():
    lines = sys.stdin.readlines()
    data = []
    i = 0
    while(i < len(lines)):
        if(int(lines[i].rstrip()) == 0) :
            break
        else:
            data.append([ int(score) for score in lines[i+1].rstrip().split() ])
            i += 2

    for scores in data:
        print(numpy.std(scores))
        
#test
if __name__ == "__main__" :

    calculate_standard_deviation()

### FIXED CODE ###

# coding: utf-8
# Here your code !
import sys
import collections
#import numpy
import statistics
import unittest


def calculate_standard_deviation():
    lines = sys.stdin.readlines()
    data = []
    i = 0
    while(i < len(lines)):
        if(int(lines[i].rstrip()) == 0) :
            break
        else:
            data.append([ int(score) for score in lines[i+1].rstrip().split() ])
            i += 2

    for scores in data:
        mean = statistics.mean(scores)
        
        print(statistics.pstdev(scores))
#        print(numpy.std(scores))

def __input_error():
    print("input error")
    return -1

class __TestValueClass(unittest.TestCase):
    def testEqual(self,func,tuples):
        self.testFunction(self.assertEqual,func,tuples)
    
    def testFunction(self,assertfunc,func,tuples):
        #tuples[index] = ([*arguments of func], compared value)
        for item in tuples:
            try:
                if isinstance(item[0], collections.Iterable):
                    assertfunc(func(*item[0]),item[1])
                else:
                    assertfunc(func(item[0]),item[1])
            except Exception as msg:
                swidth = 15
                print("="*50)
                print("-- Assertion Error in '" + func.__name__ + "' --")
                print("arguments".ljust(swidth)+":",item[0])
                print("compared value".ljust(swidth)+":",item[1])
                print("message".ljust(swidth)+":")
                print(msg)
                sys.exit()
        print(func.__name__,": succeeded")
        
#test
if __name__ == "__main__" :

    calculate_standard_deviation()
#    test = __TestValueClass()
n = int(input())
A = list(map(int,input().split()))

ans = 1
for i in range(n):
    ans = ans * a[i]
    
if ans <= 10 ** 18:
    print(ans)  
else:
    print(-1)


### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0]==0:
    print(0)
    exit()

ans = 1
for i in A:
    ans*=i
    if ans>1e18:
        print(-1)
        exit()

print(ans)
import numpy as np

N, M = [int(c) for c in input().split()]
F = np.zeros((N+2, M+2))
C = F.copy()
c = np.ones((N, M))
C[1:-1, 1:-1] += c

F[:-1, :] += C[1:, :]
F[1:, :] += C[:-1, :]
F[:, :-1] += C[:, 1:]
F[:, 1:] += C[:, :-1]
F[:-1, 1:] += C[1:, :-1]
F[1:, :-1] += C[:-1, 1:]
F[:-1, :-1] += C[1:, 1:]
F[1:, 1:] += C[:-1, :-1]

print(np.sum(np.where(F[1:-1, 1:-1] % 2, 0, 1)))

### FIXED CODE ###

N, M = [int(c) for c in input().split()]

if N == 1 and M == 1:
    print(1)
elif N == 1 or M == 1:
    print(M+N - 3)
else:
    print((M-2) * (N-2))
W = input().lower()
while True
    line = input()
    if line == 'END_OF_TEXT':
        break

     for s in line.lower().split():
         if s == W:
             count += 1

print(count)

### FIXED CODE ###

W = input()
 
count = 0
while True:
    line = input()
    if line == 'END_OF_TEXT':
        break
     
    for s in line.lower().split():
        if s == W:
            count += 1
             
         
     
print(count)
inp_ = input()
imp_list = imp_.spilt()
if inp_list[0] / inp_list[1] <= 80:
    print("Yes") 
else:
    print("No")

### FIXED CODE ###

inp = input()
inp_list = inp.split()
inp_list = [int(i) for i in inp_list] 
if inp_list[0] / inp_list[1] <= inp_list[2]:
    print("Yes") 
else:
    print("No")
from decimal import Decimal

# t = '1000000000000000 9.99'

a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))

### FIXED CODE ###

from decimal import Decimal

# t = '1000000000000000 9.99'
a = list(map(Decimal, input().split()))
# a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))