peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a = int(input())
s = input()

if a >= 3200:
    print("s")

elif a <= 3200:
    print("red")
# Judge status: Accepted
n = [0 for _ in range(26)]
S = list(input())
ans = "Yes"
for i in S:
    n[ord(i) - ord('a')] += 1
for i in n:
    if i % 2 != 0:
        ans = "No"
print(ans)
# Judge status: Accepted
S = input()[::-1]
T = input()[::-1]

flag = False
for i in range(len(S) - len(T) + 1):
    matched = True

    for j in range(len(T)):

        if S[i + j] != "?" and S[i + j] != T[j]:
            matched = False
    
    if matched:
        S = S[:i] + T + S[i + len(T):]
        flag = True
        break

if flag:
    print(S.replace("?", "a")[::-1])
else:
    print("UNRESTORABLE")
# Judge status: Accepted
x = int(input())
#6,5,6,5...で何回加算されていくか。
#余りの部分は後で処理
ans = x // 11 * 2

if x % 11 > 6:
    print(ans + 2)
elif x % 11 > 0:
    print(ans + 1)
else:
    print(ans)#余りなし=割り切れる時
# Judge status: Wrong Answer
s = input()
t = input()
ls = len(s)
lt = len(t)

def match(k):
    for i in range(lt):
        if t[i] != s[i+k] and s[i+k] != '?':
            return False
    return True

c = -1
for i in range(ls-lt+1):
    if match(i):
        c = i

if c == -1:
    print('UNRESTORABLE')
    exit()

ans = s[:c].replace('?', 'a')
ans += t
ans += s[len(ans):]
print(ans)
# Judge status: Accepted
N = int(input())
for i in range(360):
    if not N * (i + 1) % 360:
        print(i + 1)
        break
# Judge status: Accepted
s,t=map(str,input().split())
print(t+s)
# Judge status: Accepted
O = input()
E = input()

ans = ""
for i in range(len(O)+len(E)):
    if i%2 == 0:
        ans += O[i//2]
    else:
        ans += E[i//2]

print(ans)
# Judge status: Accepted
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

a, b = input().split()
a = int(a)
p, q = map(int, b.split('.'))
res = a * p + a * q // 100
print(res)
# Judge status: Accepted
n, m = map(int, input().split())

if min(n, m) == 1:
    if max(n, m) == 1:
        print(1)
    else:
        print(max(n, m)-2)
elif min(n, m) == 2:
    print(0)
else:
    print((n-2)*(m-2))
# Judge status: Wrong Answer
n, m = map(int, input().split())


def lp(animal, row):
    for i in range(1, n+1):
        row *= i
    return row

result = abs(n-m)
limit = 10**9+7
row = 1
if result >= 2:
    print(0)
    exit()
elif result == 1:
    row = lp(n, row)
    row = lp(m, row)
elif n == m:
    row = lp(n, row)
    row = lp(m, row)
    row *= 2

print(row%limit)
# Judge status: Accepted
n,m=map(int,input().split())
n,m=min(n,m),max(n,m)
if n==1:
    if m==1:
        print(1)
    else:
        print(max(0,m-2))
        exit()
else:
    print(max(0,(n-2)*(m-2)))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
P = pow(1 / 6, K)

now = sum(map(lambda a: a * (a + 1) // 2 / a, A[:K - 1]))
ans = 0
for left, right in zip(A, A[K - 1:]):
    now += right * (right + 1) // 2 / right
    ans = max(ans, now)
    now -= left * (left + 1) // 2 / left

print('{:.10f}'.format(ans))
# Judge status: Wrong Answer
n = int(input())

s = int(800 * n - 200 * n//15)

print(s)
# Judge status: Wrong Answer
x,y=map(int,input().split())

X=abs(x)
Y=abs(y)

if x<y:
    if x*y>0:
        print(y-x)
    elif x*y==0:
        print(abs(X-Y))
    else:
        print(abs(X-Y)+1)
else:
    if x*y>=0:
        print(abs(X-Y)+2)
    elif x*y==0:
        print(abs(X-Y)+1)
    else:
        print(abs(X-Y)+1)
# Judge status: Accepted
n = int(input())

if n % 2 != 0:
    print(0)
else:
    ans = 0
    tmp = 10
    while tmp <= n:
        ans += n//tmp
        tmp *= 5
    
    print(int(ans))
# Judge status: Accepted
import string
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
sl = [list(input()) for i in range(n)]

alpha = list(string.ascii_lowercase)

dic = {si: sl[0].count(si) for si in alpha}

for s in sl:
    for ch in alpha:
        dic[ch] = min(dic[ch], s.count(ch))
ans = ''
for ch in alpha:
    for i in range(dic[ch]):
        ans += ch
print(ans)
# Judge status: Wrong Answer
a = 2000

if a >= 3200:
    print("s")

if a < 3200:
    print("red")
# Judge status: Accepted
X, Y, Z = map(int, input().split())
print(Z,X,Y)
# Judge status: Accepted
odd_step=["R","U","D"]
even_step=["L","U","D"]

s=input()

ans="Yes"
for i in range(len(s)):
  if i%2 != 0:
    if not s[i] in even_step:
      ans="No"
  else:
    if not s[i] in odd_step:
      ans="No"
print(ans)
# Judge status: Accepted
n=int(input())

def dfs(s,mx):
  #print("s",s)
  if len(s)==n:
    print(s)
    return
  for i in range(ord("a"),mx+2):
    #print(i)
    #print(s+chr(i))
    dfs(s+chr(i),max(mx,i))

dfs("a",ord("a"))
# Judge status: Accepted
# 金利1%
X = int(input())
ans = 0
now = 100
while X > now:
    ans += 1
    now = int(now * 1.01)
print(ans)
# Judge status: Accepted
p,q,r=map(int,input().split())
a=min(p,q)
b=max(p,q)
c=min(b,r)
print("{}".format(a+c))
# Judge status: Wrong Answer
N,D = map(int,input().split())
a = 0
for num in range(1,N) :
  X,Y = map(int,input().split())
  if X*X + Y*Y <= D*D :
    a += 1
print(a)
# Judge status: Accepted
s=input()
if s<="2019/04/30":
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
n=int(input())
s=input()
t=s[1:].count('E')
a=t
for i in range(n-1):
  t+=(s[i]=='W')-(s[i+1]=='E')
  a=min(a,t)
print(a)
# Judge status: Accepted
n = int(input())
a_list = list(map(int,input().split()))
a_list = sorted(a_list)
flag  = [0]*n


ans = 0
m = max(a_list)
b_list = [0]*(m+1)
for i in a_list:
    b_list[i] += 1
for i in a_list:
    if b_list[i] == 1:
        ans += 1

    for j in range(i , m+1 ,i):
        b_list[j]+= 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
tail = 0
head = float('inf')
for i in range(N):
    tail = max(tail, sum(A[i]))
    head = min(head, sum(A[i]))
ans_1 = tail - head

tmp_h, tmp_t = 0, 0
tail = A[i]
head = A[i]
for i in range(N):
    tail = A[i] if tmp_h < A[i][0]-A[i][1] else tail
    head = A[i] if tmp_t < A[i][1]-A[i][0] else head

ans_2 = abs(tail[0]-head[0]) + abs(tail[1]-head[1])
ans = max(ans_1, ans_2)
print(ans)
# Judge status: Wrong Answer
N=int(input())
B=[int(x) for x in input().rstrip().split()]
A=[B[0]]
for i in range(1,N-1):
  if i+1<N-1:
    A.append(min(B[i-1],B[i],B[i+1]))
  else:
    A.append(min(B[i],B[i-1]))
A.append(B[N-2])

print(sum(A))
# Judge status: Wrong Answer
S, T = input().split()
print(S+T)
# Judge status: Accepted
import sys
#read = sys.stdin.read
from math import floor
def main():
    a, b = map(int, input().split())
    for i1 in range(1251):
        if floor(i1 * 0.08) == a and floor(i1 * 0.1) == b:
            print(i1)
            sys.exit()
    print(-1)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
h = [0]+h+[10**9+1]
for i in range(1,n+1):
  if h[i] > h[i+1]+1:
    print("No")
    exit()
  elif h[i] == h[i+1]+1:
    h[i] -= 1
    if h[i-1] > h[i]:
      print("No")
      exit()
  else:
    if h[i-1]  < h[i]:
      h[i] -= 1
print("Yes")
# Judge status: Wrong Answer
Input = input().split()
A = Input[0]
A = float(A)
B = Input[1]
B = float(B)
AB = A*B
AB = int(AB)
print(AB)
# Judge status: Accepted
s = input()
n = len(s)
ans = 0
for i in range(n // 2):
  if s[i] != s[-( i + 1)]:
    ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]
ans = [0]*N

first = sorted(A)[-1]
second = sorted(A)[-2]

for i in range(N):
    if A[i]==first:
        ans[i] = second
    else:
        ans[i] = first

print(*ans, sep="\n")
# Judge status: Accepted
d = int(input()) #日にちは-1indexで
c = list(map(int, input().split()))
csum = 0
for i in range(26):
    csum += c[i]
s = [ [] for _ in range(d)]
for i in range(d):
    s[i] = list(map(int, input().split()))
t = [0 for _ in range(d)]
for i in range(d):
    maxp = -2
    for j in range(26):
        if (s[i][j] > maxp):
            maxp = s[i][j]
            t[i] = j
    print(t[i]+1)
# Judge status: Wrong Answer
l,r,d=map(int,input().split())
ans = (r-l)//d
if ans == 0:
  print(0)
else:
  print(ans)
# Judge status: Accepted
n = int(input())
np = n % 10
if (np - 2)*(np - 4)*(np - 5)*(np - 7)*(np - 9) == 0:
    print('hon')
elif np*(np-1)*(np-6)*(np-8) == 0:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
N,X,Y = map(int, input().split())

c = [0 for _ in range(N)]
for i in range(1,N):
  for j in range(i+1,N+1):
    x = abs(X-i)
    y = abs(Y-j)
    a = min(x+y+1, j-i)
    c[a] += 1

for i in range(1,N):
  ans = c[i]
  print(ans)
# Judge status: Accepted
n = int(input())

ans = ''

if n == 0:
    print('0')

while n != 0:
    r = n % 2 

    if r < 0:
        r = r + 2
    
    n = (n-r) / (-2)

    ans = ans + str(int(r))

ans = list(ans)    
ans.reverse()
print(''.join(ans))
# Judge status: Accepted
#!/usr/bin/env python

n = int(input())
a = list(map(int, input().split()))
d = [0 for _ in range(n-1)]
for i in range(n-1):
    d[i] = a[i+1]-a[i]

ans = 1 
flg = [False, False]

for i in range(n-1):
    if d[i] > 0:
        flg[0] = True
    elif d[i] < 0:
        flg[1] = True

    if flg[0] == flg[1] == True:
        ans += 1
        flg = [False, False]

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a < b:
  print(''.join([str(a) for _ in range(b)]))
else:
  print(''.join([str(b) for _ in range(a)]))
# Judge status: Accepted
def resolve():
	N = int(input())
	A = list(map(int, input().split()))
	a_max = max(A)+1
	B = {}
	for i in range(N):
		a = A[i]
		if a not in B.keys():
			for j in range(a, a_max, a):
				B[j] = False
			B[a] = True
		else:
			B[a] = False
	Y = list(B.values()).count(True)
	print(Y)
resolve()
# Judge status: Accepted
w,a,b=map(int,input().split())
if a<=b<=a+w or a<=b+w<=a+w:
  print(0)
else:
  print(min(abs(b-(a+w)),abs(a-(b+w))))
# Judge status: Wrong Answer
s = input()
if s == "AAA" or s == "BBB":
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(max(a)):
  ans = max(ans, Counter(a)[i - 1] + Counter(a)[i] + Counter(a)[i + 1])
print(ans)
# Judge status: Wrong Answer
n = int(input())
re = 1

list = [int(s) for s in input().split()]
  
for i in range(n):
    re *= list[i]
    
if(re >= 100000000000000100000):
    print("-1")
else:
    print(re)
# Judge status: Accepted
o = input()
e = input()

for i in range(len(o)+len(e)):
    if i % 2 == 0:
        print(o[i//2],end="")
    elif i % 2 == 1:
        print(e[(i-1)//2],end="")
# Judge status: Accepted
# E - Red and Green Apples
def main():
    X, Y, A, B, C = map(int, input().split())
    P = sorted(map(int, input().split()), reverse=True)[:X]
    Q = sorted(map(int, input().split()), reverse=True)[:Y]
    R = list(map(int, input().split()))
    PQR = P + Q + R
    PQR.sort(reverse=True)
    ans = sum(PQR[: X + Y])
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
a=['a','b','c','d','e','f','g','h','i','j']

def dfs(s, count):
    if len(s) == n:
        print(s)
        return
 
    for z in range(count + 1):
        dfs(s + a[z], count + 1 if z == count else count)

dfs("",0)
# Judge status: Accepted
a, b= map(int, input().split())
if a == 1:
    print('1')
elif b == 1:
    print('1')
else:
    if (a*b)%2 == 0:
        print(round((a*b)/2))
    else:
        print(round(((a//2)+(a%2))*b)-(b//2))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
dic={}
for a in A:
  if a in dic.keys():
    dic[a]+=1
  else:
    dic[a]=1
r=0
for a in dic.keys():
  c=dic[a]
  r+=c*(c-1)//2
for i in range(N):
  c=dic[A[i]]
  print(r - c*(c-1)//2 + (c-1)*(c-2)//2 )
# Judge status: Wrong Answer
import math
a,b,n = map(int,input().split())
ans = 0
al = []
for i in range(n,-1,-1):
    ans = ((a*i)//b)-(a*(i//b))
    al.append(ans)
    if len(al) > 1:
        if al[-1] < al[-2]:
            break
print(max(al))
# Judge status: Accepted
N = int(input())
W = [tuple(input()) for _ in range(N)]

now = W[0][-1]
said = [W[0]]

for w in W[1:]:
    if not w in said and w[0] == now:
        now = w[-1]
        said.append(w)
        continue
    print("No")
    exit()

print("Yes")
# Judge status: Accepted
n = input().split()
total_list =[]
a = 0
for i in range(3):
    a = int(n[i-1]) + int(n[i])
    total_list.append(a)
    
print(min(total_list))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from bisect import *

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0

for i in range(N):
    for j in range(i+1, N):
        k = bisect_left(L, L[i]+L[j])
        ans += k-j-1

print(ans)
# Judge status: Wrong Answer
R=int(input())
print(R*3.1415926)
# Judge status: Accepted
# coding: utf-8
# Your code here!
input_line = input().split()
N = int(input_line[0])
M = int(input_line[1])
count = 0
line = input().split()
for i in range(M):
    count+=int(line[i])
    
if N - count <= -1:
    print(-1)
    
    
else:
    print(N - count)
# Judge status: Accepted
n = int(input())

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

c = [0]*9
for i in a:
  t = i // 400
  if t < 8:
    c[t] = 1
  else:
    c[8] += 1
cmin = max(sum(c[:-1]), min(c[8], 1))
cmax = sum(c)
print(cmin, cmax)
# Judge status: Wrong Answer
from bisect import*
n, *l = map(int, open(0).read().split())
print(sum(max(0, bisect_left(l, l[i] + l[j]) - j - 1) for i in range(n) for j in range(i+1, n)))
# Judge status: Wrong Answer
a,b = map(int,input().split())

if a == b:
    print('Draw')
elif a == 1 or a > b:
    print('Alice')
else:
    print('Bob')
# Judge status: Accepted
n = int(input())
vv = sorted([int(x) for x in input().split()])

while len(vv) > 1:
  a, b = vv[:2]
  vv = vv[2:]
  vv = sorted([(a + b) / 2] + vv)

print(vv[0])
# Judge status: Accepted
s = input()
a = s.lower()
l = len(s)
c = 0
n = 0

if s[0] == 'A':
  for i in range(2 , l-1):
    if s[i] == 'C':
      c += 1
  if c == 1:
    for i in range(1,l):
      if s[i] != a[i]:
        n += 1
    if n == 1:
      print('AC')
      exit()
print('WA')
# Judge status: Accepted
n,m=map(int,input().split())
lists=list(map(int,input().split()))
uselist=[]
for some in lists:
    some=some//2
    uselist.append(some)

import fractions
import math
ans = uselist[0]
for i in range(1, n):
    ans = ans* uselist[i] // fractions.gcd(ans, uselist[i])

flags=True
for some in uselist:
    a=ans//some
    if a%2==0:
        flags=False
        break
if flags:
    p=math.floor(m/ans)
    if p%2==0:
      print(p//2)
    elif p%2!=0:
      print(p//2+1)
    
else:
    print(0)
# Judge status: Accepted
n, k = map(int, input().split())
x = list(map(int, input().split()))

sx=sorted(x)
ans=0
for i in range(k):
  ans=ans + sx[i] 
print(ans)
# Judge status: Accepted
N = int(input())
if N % 2:
    print(0)
    exit()
ans = 0
x = 1
while pow(5, x) <= N:
    ans += N // 2 // pow(5, x)
    x += 1
print(ans)
# Judge status: Accepted
from sys import stdin
K = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
ans = S[:K]
if len(S) > K:
  ans += '...'
print(ans)
# Judge status: Wrong Answer
x=input()
for i in x:
  if i=="7":
    print("Yes")
else:
  print("No")
# Judge status: Accepted
import numpy as np

[n,m,x] = [int(x) for x in input().split()]
data = np.array([[int(x) for x in input().split()] for _ in range(n)])

ans = []

for i in range(2**(n)):
    temp = np.array([0]*(m+1))

    for j in range(n):
        if (i >> j) & 1:
            temp = temp + data[j]
    
    for k in temp[1:]:
        if k < x:
            break
    else:
        ans.append(temp[0])

if ans == []:
    print(-1)
else:
    print(min(ans))
# Judge status: Accepted
import queue
K = int(input())

q = queue.Queue()
[q.put(i) for i in range(1, 10)]
for _ in range(K):
    num = q.get()
    mod = num % 10
    deca = num * 10 + mod 
    if mod != 0:
        q.put(deca - 1)
    q.put(deca)
    if mod != 9:
        q.put(deca + 1)
        
print(num)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 7)


N = int(input())
L = list("abcdefghij")

def nasu(x, n, e):
  if n == N:
    print(x)
    return
  for i in range(e + 1):
    if i == e:
      nasu(x + L[i], n + 1, e + 1)
    else:
      nasu(x + L[i], n + 1, e)

nasu("", 0, 0)
# Judge status: Accepted
a, b = map(int, input().split())

if (a <= b):
	print(a)
else:
	print(a - 1)
# Judge status: Wrong Answer
A, B, C = map(int,input().split())
if A % 2 == C % 2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
li = [] # AとBのリスト
x = 0
 
for i in range(n):
    li.append(list(map(int,input().split())))
li.sort(key=lambda x: x[1]) # Bの締め切りの早いものでソート
 
for i in range(n):
    x += li[i][0]
    if x > li[i][1]:
        print("No") # 締め切りの早いものから終わらせていき、終わらなかったらNo
        exit()
 
print("Yes")
# Judge status: Accepted


startX, countK, distanceD = map(int, input().split())
n = int(abs(startX) / distanceD)
ans = abs(startX) % distanceD
if n > countK:
    ans += distanceD * (n - countK)
else:
    if (countK - n) % 2 == 1:
        ans= abs(ans - distanceD)
print(ans)
# Judge status: Accepted
h1,m1,h2,m2,k = map(int,input().split())

a = h1*60 + m1
b = h2*60 + m2

print(b-a-k)
# Judge status: Accepted
w,h,x,y=map(int,input().split())
print(str(w*h/2)+' '+str(1*(w==2*x and h==2*y)))
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
ml=max(l)
m=[0]*(ml+1)
for i in l:
    m[i]+=1
for i in range(ml+1):
    if m[i]>=1:
        for j in range(2*i,ml+1,i):
            if m[j]>0:
                m[j]=0
                #print(j)
for i in range(ml+1):
    if m[i]>=2:
        m[i]=0
print(sum(m))
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))

res = 0
mini = P[0]
for i in range(N):
    mini = min(mini, P[i])
    if(mini >= P[i]):
        res += 1
print(res)
# Judge status: Accepted
a, b = input().split()

cnt = 0

if( a <= b ):
  cnt = a
  for i in range(int(b)):
    print(cnt, end="")
else:
  cnt = b
  for i in range(int(a)):
    print(cnt, end="")
    
print("")
# Judge status: Wrong Answer
S=input()

if S is'ABC':
  print('ARC')
else:
  print('ABC')
# Judge status: Wrong Answer
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    N, K = map(int, input().split())
    p = [((int(i)+1) * int(i) / 2)/int(i) for i in input().split()]
    dp = [0 for i in range(N-K+1)]
    dp[0] = 0
    for i in range(1, N-K+1):
        dp[i] = max(dp[i-1], sum(j for j in p[i:i+K]))
    print(max(dp))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,m=map(int,input().split())
A=[input() for _ in range(n)]
B=[input() for _ in range(m)]
ok=0
for i in range(n-m+1):
  for k in range(n-m+1):
    if B[0]==A[i][k:k+m]:
      for j in range(i,i+m):
        if B[j-i]!=A[j][k:k+m]:
          break
        else:
          ok=1
print("Yes" if ok==1 else "No")
# Judge status: Wrong Answer
import math
X,Y=map(int,input().split())
print(int(math.log2(Y/X))+1)
# Judge status: Accepted
n=int(input())
l=list(map(int, input().split()))
l.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]+l[j]>l[k] and l[i]!=l[j] and l[j]!=l[k]:
        ans+=1
print(ans)
# Judge status: Accepted
S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())

limit = 10 ** 18

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

flg = True
if l[0] == 0:
    flg = False
    print(0)
else:
    ans = 1
    for i in l:
        if ans > limit:
            print(-1)
            flg = False
            break
        else:
            ans *= i
            
if flg:
    print(ans if ans <= limit else -1)
# Judge status: Accepted
n,d = map(int, input().split())
a = (2*d+1)
if (n % a == 0):
    print(n//a)
else:
    print(n//a + 1)
# Judge status: Accepted
n,k,q=map(int, input().split())
a = [0]*(n+1)
for i in range(q):
  a[int(input())] += 1
  
for i in range(1, n+1):
  a[i] += k-q
  if a[i] > 0:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
import math
from collections import defaultdict
import itertools
N = int(input())
town = [[int(i) for i in input().split(' ')] for _ in range(N)]

dist = 0
c = 0
for v in itertools.permutations(town,len(town)):
    c += 1
    sx = v[0][0]
    sy = v[0][1]
    for i in v[1::]:
        dist += math.sqrt((sx - i[0]) ** 2 + (sy - i[1]) ** 2)
        sx, sy = i[0], i[1]

print(dist/c)
# Judge status: Accepted
def main():
    n,m=map(int,input().split())
    a=list(map(int,input().split()))
    s=sum(a)
    ans=n-s if n-s>=0 else -1
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
# 文字を取得
c = str(input())
v_list = ["a","e","i","o","u"]

# 母音なのかを確認し結果を出力
if c in v_list:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
n, k = map(int, input().split())
ans = [0] * n
cnt = 0
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
        ans[j-1] += 1
for i in ans:
    if i == 0:
        cnt += 1
print(cnt)
# Judge status: Accepted
import sys
input = sys.stdin.readline

S=input().strip()
K=int(input().strip())

n = 0
m = 0
for c in S:
    if c != '1':
        m = int(c)
        break
    n += 1
if K <= n:
    print(1)
else:
    print(m)
# Judge status: Accepted
n = int(input())
al =  list(map(int, input().split()))

new_al = []
for i,a in enumerate(al):
    new_al.append(a-i-1)

new_al.sort()
if n%2 == 0:
    med = (new_al[n//2] + new_al[n//2-1])/2
else:
    med = new_al[n//2]

ans = 0
for a in new_al:
    ans += abs(a-med)

print(int(ans))
# Judge status: Accepted
N,M=map(int,input().split())
H=list(map(int,input().split()))
AB=[]
for i in range(M):
    AB.append(list(map(int,input().split())))

J=[0]*N
for i in range(M):
    if H[AB[i][0]-1]<H[AB[i][1]-1]:
        J[AB[i][0]-1]+=1
    elif H[AB[i][0]-1]==H[AB[i][1]-1]:
        J[AB[i][0]-1]+=1
        J[AB[i][1]-1]+=1    
    else:
        J[AB[i][1]-1]+=1
c=0
for i in J:
    if i == 0:
        c+=1

print(c)
# Judge status: Wrong Answer
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
Q = 10**9+7
def main():
    N = int( input())
    A = list( map( int, input().split()))
    s = 1
    for a in A:
        s = s*a//gcd(a,s)
    ans = 0
    for a in A:
        ans += s//a
    print(ans)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math

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

#全部選ぶときの和の個数は0+1+2+ ~ +nの1+(n+1)n/2個

#k個は好きな選び方ができる。
#k個以上の数を選ぶときに「絶対に満たせない和の値」を考える。
#その数は10**100 + 10**100+1 + ... + 10*100+k-1 -1 の(k-1)k/2である。

result_before_division = 1+(n+1)*n/2 - (k-1)*k/2

result = result_before_division % (10**9 + 7)

print(int(result))
# Judge status: Wrong Answer
n=int(input())
ab = []
for _ in range(n-1):
    a, b, c = (int(x) for x in input().split())
    ab.append([a, b, c])

for i in range(n-1):
    ans = ab[i][0]+ab[i][1]
    for j in range(i+1,n-1):
        if ans <= ab[j][1]:
            ans = ab[j][1]
        elif (ans-ab[j][1])%ab[j][2]!=0:
            ans += (ans-ab[j][1])%ab[j][2]
        ans += ab[j][0]
    print(ans)
        
print(0)
# Judge status: Wrong Answer
N, K = list(map(int, input().split()))
d = []
A = []
B = set()
for i in range(K):
    _d = int(input())
    _A = list(map(int, input().split()))
    d.append(_d)
    A.append(_A)
    _B = set(_A)
    B = B or _B
print(N - len(B))
# Judge status: Accepted
N=int(input())
print((10**N-8**N-(2*(9**N-8**N)))%(10**9+7))
# Judge status: Accepted
List = list(map(int, input().split()))

Set0 = List[0]//(List[1]+List[2])
E = List[0] - (List[1]+List[2])*Set0

if E >= List[1]:
    Blue = Set0 * List[1] + List[1]
else:
    Blue = Set0 * List[1] + E

print(Blue)
# Judge status: Wrong Answer
a=input()
b=input()

i=0
j=0

s=""

while(i<len(a) and j<len(b)):
	s+=a[i]
	s+=b[j]
	i=i+1
	j=j+1

print(s)
# Judge status: Accepted
S = str(input())
K = int(input())

one = 0

for i in range(len(S)):
  if S[i] == "1":
    one += 1
  else:
    notone = S[i]
    break
#print(one,K,notone)
if one >= K:
  print("1")
else:
  print(notone)