peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
s = input()
ecounter = [0 for _ in range(n)]
wcounter = [0 for _ in range(n)]
ecounter[0] = int(s[0]=='E')
wcounter[n-1] = int(s[n-1]=='W')
ans = n
for i in range(n-1):
    ecounter[i+1] = ecounter[i] + (s[i+1]=='E')
    wcounter[n-2-i] = wcounter[n-1-i] + (s[n-2-i]=='W')
for j in range(n):
    cnt = n - (ecounter[j]+wcounter[j])
    ans = min(cnt,ans)
print(ans)
# Judge status: Accepted
# coding: utf-8

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

ans = 0
for i in range(a,b+1):
    if str(i) == "".join(reversed((str(i)))):
        ans += 1

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
m_root = int(m**0.5)
ans=0
for i in range(1,m_root+1):
	if m%i == 0 and m/i >= n:
		ans = max(ans, i)
print(ans)
# Judge status: Wrong Answer
from collections import deque

S = deque(input().split())
Q = int(input())

for i in range(Q):
    QList = deque(input().split())
    
    if QList[0] == '1':
        S.reverse()
    else:
        if QList[1] == '1':
            S.appendleft(QList[2])
        else:
            S.append(QList[2])
print("".join(list(S)))
# Judge status: Wrong Answer
import sys
from collections import defaultdict
from collections import deque

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

graph = defaultdict(list)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    graph[a].append(b)
    graph[b].append(a)

q = deque([1])
cnt = 0

while q and cnt <= 2:
    cnt += 1
    node = q.popleft()
    after = graph[node]

    for a in after:
        q.append(a)
        if a == n:
            print("POSSIBLE")
            sys.exit()

print("IMPOSSIBLE")
# Judge status: Accepted
n, d = map(int, input().split())

ans = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x**2 + y**2 <= d**2:
        ans += 1
print(ans)
# Judge status: Accepted

import math

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

if x<a*a*b/2:
    a2=2*x/a/b
    t=math.atan(b/a2)*180/math.pi
    print(t)
else:
    t=math.atan(2*(b-x/a/a)/a)*180/math.pi
    print(t)
# Judge status: Wrong Answer
n = int(input())
print(n*800-(n%15)*200)
# Judge status: Accepted
a,b,c = map(int,input().split())

ans=0
if a*b*c%2==0:
    ans=0
else:
    ans = min(a*b,b*c,a*c)
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
r = s.count('R')
g = s.count('G')
b = s.count('B')
count = r*g*b
for i in range(n):
    for d in range(n):
        j = i+d
        k = j+d
        if k >= n: 
            break
        if s[i]!=s[j] and s[j]!=s[k] and s[k] != s[i]: 
            count -= 1
            
print(count)
# Judge status: Wrong Answer
n = int(input())
ans = [0]*(n+5)

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            temp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n>=temp:
                print(x,y,z, temp)
                ans[temp]+=1


for i in range(1,n+1):
    print(ans[i])
# Judge status: Accepted
import heapq as hp
n, m = (int(x) for x in input().split())
a = [int(x)*(-1) for x in input().split()]
hp.heapify(a)
for _ in range(m):
    min = hp.heappop(a)
    hp.heappush(a, (-1)*(-min//2))
print(-sum(a))
# Judge status: Wrong Answer
N,x=map(int, input().split())
A=sorted(list(map(int, input().split())))
cnt=0
for i in A:
  if x >= i:
    x -= i
    cnt+=1
  else:
    break
print(cnt)
# Judge status: Wrong Answer
# import single number
def import_number():
    return int(input())

# import n line int
def import_int(n):
    return [int(input()) for i in range(n)]

n = import_number()
tmp = n % 100
if n / 100 == 7:
    print('Yes')
elif tmp / 10 == 7:
    print('Yes')
elif tmp % 10 == 7:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
#ABC 079 C
a,b,c,d=list(input())
s="+-"

for i in range(2):
    for j in range(2):
        for k in range(2):
            if eval(a+s[i]+b+s[j]+c+s[k]+d)==7:
                print(str(a+s[i]+b+s[j]+c+s[k]+d)+"=7")
# Judge status: Accepted
s=input()
cand=["0"+str(i) for i in range(1,10)]+["10","11","12"]
if s[:2] in cand and s[2:] in cand:
    print("AMBIGUOUS")
elif s[:2] in cand:
    print("MMYY")
elif s[2:] in cand:
    print("YYMM")
else:
    print("NA")
# Judge status: Accepted
import math
N=int(input())
A=[int(input()) for i in range(5)]
print(math.ceil(N/min(A)+4))
# Judge status: Wrong Answer
n = int(input())

arr = [int(x) for x in input().split()]

left = [0]
for i in range(1,n):
  left.append(left[-1]^arr[i-1])
arr = arr[::-1]
right = [0]
for i in range(1,n):
  right.append(right[-1]^arr[i-1])
right = right[::-1]
arr  = arr[::-1]

ans = []
for i in range(n):
  ans.append(left[i]^right[i])

print(ans)
# Judge status: Wrong Answer
n = int(input())
right = []
scope = {}
for _ in range(n):
    x, l = map(int, input().split())
    right.append(x+l)
    scope[x+l] = [x-l, x+l]
    
right.sort()
ans = 0
border = 10**9 * (-1)
for i, r in enumerate(right):
    if border <= scope[r][0]:
        ans += 1
        border = scope[r][1]
print(ans)
# Judge status: Accepted
N, M = list(map(int, input().split()))
correct = 0
incorrect = 0
Q = [0] * N
num_WA = [0] * N
for i in range(M):
    s, t = input().split()
    s = int(s)

    if t == 'AC':
        if Q[s-1] == 1:
            continue
        else:
            Q[s-1] = 1
            correct += 1
            incorrect += num_WA[s-1]
    else:
        num_WA[s-1] += 1
print(correct, incorrect)
# Judge status: Accepted
X = list(map(int, input().split()))

ans = 0
for x in X:
  ans += 1
  if x == 0: break
    
print(ans)
# Judge status: Wrong Answer
i = int(input())
luca = [2,1,3]
for l in range(i-2):
	num = luca[-1]+luca[-2]
	luca.append(num)
print(luca[-1])
# Judge status: Accepted
l=sorted([int(i) for i in input().split()])
print(int(str(l[2])+str(l[1]))+l[0])
# Judge status: Accepted
s = input()
num = 9999
for i in range(len(s)-2):
  num = min(num, abs(int(s[i:i+3])-753))
print(num)
# Judge status: Accepted
X = int(input())

num_list = []
for i in range(1, int(1000**0.5)+1):
    for j in range(2, 11):
        if i**j <= 1000:
            num_list.append(i**j)

for num in sorted(num_list, reverse=True):
    if num <= X:
        print(num)
        break
# Judge status: Accepted
def resolve():
    S = input()
    print(S[:3])
resolve()
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

for _ in range(k):
    if a > b and a > c:
        a *= 2
    elif b > a and b > c:
        b *= 2
    else:
        c *= 2
print(a + b + c)
# Judge status: Accepted
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())

    res = set()
    for _ in range(K):
        _ = int(input())
        A = list(map(int, input().split()))
        for a in A:
            res.add(a)

    ans = 0
    for i in range(1, N + 1):
        if i not in res:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

if n % max(h,w) == 0:
    print(n//max(h,w))
else:
    print(n//max(h,w)+1)
# Judge status: Accepted
#GCD, LCM
def gcd_base(a, b):
    while b!=0:
        a, b = b, a%b
    return a

def lcm(num_list):
    ans = 1
    for i in num_list:
        ans = ans * i // gcd_base(ans, i)
    return ans

n = int(input())
a = list(map(int, input().split()))
l = lcm(a)
mod = 10**9+7
total = 0
for i in a:
    total += l//i
print(total%mod)
# Judge status: Wrong Answer
s,t,d=map(int,input().split())

if d/s<t:
    print('yes')
else:
    print('no')
# Judge status: Wrong Answer
n = int(input())
v = list(map(int, input().split()))

v.sort()
ans = (v[0] + v[1]) / 2

for i in range(2, n):
    print(i)
    ans = (ans + v[i]) / 2
print(ans)
# Judge status: Accepted
N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
D = [x[i + 1] - x[i] for i in range(len(x) - 1)]
# print(D)


def gcd(a, b):
    return a if b == 0 else gcd(b, a % b)


if len(x) == 1:
    print(x[0])
    exit()
# if len(x) == 2:

ans = 0
for i in range(len(D)):
    if i == 0:
        ans = D[i]
    else:
        ans = gcd(D[i], ans)
print(ans)
# Judge status: Wrong Answer
a = input()
if(a.find("hi")!=-1):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input().strip()
C = {"0":0,"1":0}
for i in range(len(S)):
    C[S[i]] += 1
print(min(C["0"],C["1"])*2)
# Judge status: Accepted
N,M = map(int,input().split())
A = list(map(int,input().split()))
tot = sum(A)
if tot>N:
    print(-1)
else:
    print(N-tot)
# Judge status: Accepted
N,M = map(int,input().split())
list_A = list(map(int,input().split()))

sum = sum(list_A)
if N-sum>=0:
    print(N-sum)
else:
    print('-1')
# Judge status: Accepted
import sys

MOD=10**9+7

n=int(input())  
a=[int(i) for i in sys.stdin.readline().split()]

from fractions import gcd
m=a[0]
for i in a:
  m=i//gcd(m,i)*m
  
ans=0
for i in a:
  ans+=m//i

print(ans%MOD)
# Judge status: Accepted
x = int(input())

# x = 149696127901
def calculate(x):

    if x <= 6:
        return 1

    a = x // 11
    mod = x % 11

    if mod == 0:
        return 2*a

    if mod >= 7:
        return 2*a + 2

    return 2*a + 1



res = calculate(x)

print(res)
# Judge status: Accepted
A = int(input())
B = int(input())
print(6-A-B)
# Judge status: Wrong Answer
n=int(input())
l=[]
i=1
while(True):
  i+=1
  if n%2==0:
    n=n/2
  else:
    n=3*n+1
  if n in l:
    print(i)
    break
  else:
    l+=[n]
# Judge status: Wrong Answer
import sys
import math
input = sys.stdin.readline

q, h, s, d = map(int, input().split())
n = int(input())
ans = 0

if n >= 2:
  ans += min(8 * q, 4 * h, 2 * s, d) * math.floor(n /2)
  
ans += min(4 * q, 2 * h, s)
print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split(' ')))
acc = A[0]
S = sum(A)
ans= abs(S-2*acc)
for i in A[1:]:
    acc += i
    ans = min(ans,abs(S-2*acc))
print(ans)
# Judge status: Accepted
a=[0]*26
S=input()
i=0
while True:
    if i==len(S):
        print("yes")
        break
    b=ord(S[i])-97
    if a[b]==1:
        print("no")
        break
    else:
        a[b]=1
        i+=1
# Judge status: Accepted
a,b = map(float,input().split())
a= int(a)
b= int(b*1000)

print(int(a*b//1000))
# Judge status: Accepted
n, k, s = list(map(int, input().split()))
i = 0
list = []
while i < k:
  print(str(s) + ' ', end="")
  i = i + 1
while i < n:
  if s != 1000000000:
    print(str(s+1) + ' ',end="")
  else:
    print(str(s-1) + ' ',end="")
  i = i + 1
# Judge status: Accepted
S = input()
Date = ["SUN", 'MON', "TUE", "WED", "THU", "FRI", "SAT"][::-1]

print(Date.index(S)+1)
# Judge status: Wrong Answer
import math
a,b,n = map(int,input().split())
#li = []

#for x in range(n+1):
ans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))
if ans == 0:
    print(0)
else:
    print(math.floor(ans))

#print(max(li))
# Judge status: Accepted
mod=10**9+7

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
  
if x*2<y or y*2<x:
  print(0)
  exit()
  
z=(x+y)//3

x-=z
y-=z

n=x+y
r=x

if x==0 or y==0:
  print(1)
  exit()
  

lst=[0]+[1]
for i in range(2,n+10):
  lst.append((lst[-1]*i)%mod)


xxx=lst[n]
xxx*=pow(lst[n-r],10**9+5,mod)
xxx%=mod
xxx*=pow(lst[r],10**9+5,mod)
xxx%=mod

print(xxx)
# Judge status: Accepted
n=int(input())
s=''
while n!=0:
    s=str(n%2)+s
    n=-(n//2)
if s!='':
    print(s)
else:
    print(0)
# Judge status: Accepted
import math
from functools import reduce
from sys import stdin 
n = int(stdin.readline().rstrip())
def gcd(*numbers):
    return reduce(math.gcd, numbers)
answer = 0
for i in range(n):
    for j in range(n):
        for k in range(n):
            answer += gcd(i+1,j+1,k+1)
print(answer)
# Judge status: Wrong Answer
n = int(input())
As = list(map(int,input().split()))
sum = 0
step =0

try:
    for i in range(n):
        if As[i] > As[i + 1]:
            step = As[i] - As[i + 1]
            print(step)
            As[i + 1] += step
            print("As["+str(i + 1)+"]:"+str(As[i + 1]))
            sum += step 
except IndexError:
    pass

print(sum)
# Judge status: Accepted
n,k=map(int, input().split())
k-=1
s=input()
s=s[:k]+s[k].lower()+s[k+1:]
print(s)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

answer = -1
m = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        m += 1
    else:
        answer = max(answer, m)
        m = 0
answer = max(answer, m)
print(answer)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())

if b <= c:
  print(0)
  exit()
  
if b <= d:
  print(d-c)
else:
  print(b-c)
# Judge status: Accepted
n=int(input())

print(n*(n+1)//2)
# Judge status: Wrong Answer
N = int(input())
st = set()
s = []

for i in range(N):
    tmp = input()
    st.add(tmp)
    s.append(tmp)

M = int(input())
t = []

for i in range(M):
    t.append(input())

ans = -100
tmp = 0

for x in st:
    print(x)
    tmp = s.count(x)
    tmp -= t.count(x)
    ans = max(ans, tmp)

print(ans if 0 <= ans else 0)
# Judge status: Accepted
a,b,c,k = map(int, input().split())

total = 0
for target, point in [(a,1),(b,0),(c,-1)]:
    num = min(target, k)
    k -= num
    total += point * num
    if k <= 0:
        break

print(total)
# Judge status: Accepted
n, m = map(int, input().split())
ans = ['']*m
mat = [list(map(int, input().split())) for _ in range(m)]
d = {}
for idx in range(m):
    p, y = mat[idx]
    y = (y, idx)
    ans[idx] += str(p).zfill(6)
    if p in d:
        d[p].append(y)
    else:
        d[p] = [y]

for v in d.values():
    v.sort(key=lambda x: x[0])
    for i, (_, idx) in enumerate(v):
        i += 1
        ans[idx] += str(i).zfill(6)

for a in ans:
    print(a)
# Judge status: Accepted
def main():
    N, K, *xn = map(int, open(0).read().split())
    ans = int(1e9 + 7)
    for xl, xr in zip(xn[:], xn[K - 1:]):
        t = min(ans, xr - xl + min(abs(xr), abs(xl)))
        ans = t if t < ans else ans
    print(ans)
    return


main()
# Judge status: Wrong Answer
n = int(input())
c_l = list(input())

l = 0
r = n-1
w_n = 0
r_n = 0

while l < r:
    if c_l[l] == 'W':
        w_n += 1
    if c_l[r] == 'R':
        r_n += 1
    l += 1
    r -= 1

if w_n == 0:
    print(0)
else:
    print(max(w_n, r_n))
# Judge status: Accepted
import math
from functools import reduce
N = int(input())
A = list(map(int, input().split()))

print(reduce(math.gcd, A))
# Judge status: Accepted
import sys
from collections import deque
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

K = I()
d = deque([i for i in range(1,10)])

cnt = 0
while True:
  num = d.popleft()
  cnt += 1
  if cnt == K:
    print(num)
    break
  tmp = int(str(num)[-1])
  for i in range(tmp-1,tmp+2):
    if i == -1 or i == 10:
      continue
    else:
      d.append(str(num) + str(i))
# Judge status: Accepted
k = int(input())
val = 7
val %= k
for i in range(k+1):
	if(val ==0):
		print(i+1)
		break
	val = (val * 10 + 7) % k
else:
	print(-1)
# Judge status: Wrong Answer
n=int(input())
if n%2 == 0:
    num=10
    c=0;
    while num <= n:
        c += int(n/num)
        num *= 5
    print(c)
else:
    print(0)
# Judge status: Wrong Answer
H, W = map(int, input().split())
print(-(-H*W // 2))
# Judge status: Accepted
# -*- coding: utf-8 -*-

# for文を3つ回すと間に合わない
# a + b + c = s が決まるとき a, b, s が決まれば c が決まる

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

cnt = 0

for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            cnt = cnt + 1

print(cnt)
# Judge status: Wrong Answer
from bisect import bisect_left, bisect_right

def LIS(arr):  #bisect.bisect_left
    n = len(arr)
    lis = [10**18]
    for a in arr:
        if a >= lis[-1]:
            lis.append(a)
        else:
            lis[bisect_left(lis, a)] = a
    return len(lis)

import sys
input = sys.stdin.readline

N = int(input())
A = [-int(input()) for _ in range(N)]

print(LIS(A))
# Judge status: Wrong Answer
import math
x,y=map(int,input().split())
ans=x

while x<=y:
    x*=2
print(x//2)
# Judge status: Accepted
print(["Heisei","TBD"][input()[5:7]>"04"])
# Judge status: Accepted
a, b, n = map(int, input().split())
print((a*min(b-1,n))//b)
# Judge status: Accepted
h, w = list(map(int, input().split()))

if h == 1 or w == 1:
    print(1)
else:
    print((h*w+1)//2)
# Judge status: Accepted
import math
n = int(input())
for i in range(50000):
  if math.floor(i*1.08)==n:
    print(i)
    exit()
print(':(')
# Judge status: Accepted
N = int(input())
S = input()
r = 0
g = 0
b = 0
for a in range(N):
    if S[a] == "R":
        r += 1
    elif S[a] == "G":
        g += 1
    elif S[a] == "B":
        b += 1
all = r*g*b
count = 0
for i in range(0, N-2):
    for j in range(i+1, N-1):
        k = 2*j-i
        if k < N:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
                count += 1
print(all-count)
# Judge status: Accepted
n, k, q = map(int, input().split())
A = [int(input()) for _ in range(q)]

B = [k-q]*n
for i in range(q):
    B[A[i]-1] += 1

for i in range(n):
    if B[i] <= 0:
        print('No')
    else:
        print('Yes')
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    print(input().strip()[:3])

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())

if (N >= 1000):
    ans = 'ABD'
else:
    ans = 'ABC'

print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split());s=input();print(s.replace(s[k-1],s[k-1].lower()))
# Judge status: Accepted
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
ans = "YES"
if(V<=W):
  ans = "NO"
elif(abs(A-B)>T*abs(V-W)):
  ans = "NO"
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0] * n
dp_memo = 10 ** 4

for i in range(1, n):
    for j in range(min(k, i)):
        memo = abs(h[i] - h[i - j - 1]) + dp[i - j - 1]
        if dp_memo > memo:
            dp_memo = memo
    dp[i] = dp_memo
    dp_memo = 10 ** 4

print(dp[n - 1])
# Judge status: Accepted
s = input()

ans = s[:3]
print(ans)
# Judge status: Accepted
n,p = map(int,input().split())
a = list(map(int,input().split()))

odd = 0
even = 0
for i in a:
    if i%2 == 0:
        even += 1
    else:
        odd += 1
if odd == 0:
    if p == 1:
        print(0)
    else:
        print(2 ** n)
else:
    print(2 ** (n - 1))
# Judge status: Accepted
X,Y=list(map(int, input().split()))
a=(2*X-Y)//3
b=(2*Y-X)//3
if not (2*a+b==X and a+2*b==Y and a>=0 and b>=0):
    print(0)
    exit()

C=10**9+7
A=1
B=1
D=1
for i in range(a):
    A*=i+1
    A=A%C
for j in range(b):
    B*=j+1
    B=B%C
for k in range(a+b):
    D*=k+1
    D=D%C

D*=pow(A,C-2,C)
D*=pow(B,C-2,C)
print(D%C)
# Judge status: Wrong Answer
S=input()
N=len(S)
L=[0]*(N+1)
for i in range(len(S)):
    if S[i]=="<":
        L[i+1]+=L[i]+1

for i in range(len(S)-1,-1,-1):
    if S[i]==">":
        L[i]=max(L[i+1]+1,L[i])
print(L)
print(sum(L))
# Judge status: Accepted
n=int(input())
sp=[list(input().split()) for _ in range(n)]
for i in sp:
    i[1]=100-int(i[1])
for i in range(n):
    sp[i].append(i+1)
sp.sort()
for i in sp:
    print(i[2])
# Judge status: Accepted
from collections import deque

N = int(input())
t = deque([0] * N)
x = deque([0] * N)
y = deque([0] * N)

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

N += 1
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)

for i in range(N-1):
    t_sub = t[i+1] - t[i]
    x_sub = abs(x[i+1] - x[i])
    y_sub = abs(y[i+1] - y[i])
    dist = x_sub + y_sub
    if dist > t_sub or t_sub % 2 != dist % 2:
        print('No')
        exit()

print('Yes')
# Judge status: Wrong Answer
n=input()
print(int(n)//2)
# Judge status: Wrong Answer
k = int(input())
a, b = map(int, input().split())

for i in range(a,b+1) :
  if i%k == 0 :
    print('OK')
    exit(0)

print('NO')
# Judge status: Accepted
h,n = map(int, input().split())
a = list(map(int, input().split())) 
total = 0
for ai in a:
  total += ai
if total >= h:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
s = input()
li_s = list(s)

import collections
c = collections.Counter(li_s)
cci = c.items()
#print(cci)
tmp = 1
for cc in cci:
    #print(cc[1])
    tmp *= (cc[1]+1)
print((tmp-1)%(10**9+7))
# Judge status: Accepted
import math
import itertools
n = int(input())
#n, m = map(int, input().split())
#hl = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
total = 0
townnum = [i for i in range(n)]
for v in itertools.permutations(townnum):
    for j in range(1, n):
        cur = l[v[j]]
        bef = l[v[j-1]]
        total += math.sqrt((cur[0]-bef[0])**2+(cur[1]-bef[1])**2)
ans = total/math.factorial(n)
print('{:.9f}'.format(ans))
# Judge status: Accepted
n, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))

for i in range(k, n):
    if a[i-k] < a[i]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))

x = int(input())

ans = 0

ans += x // 500 * 1000

ans += x % 500 // 5 * 5

print(ans)
# Judge status: Wrong Answer
x = int(input())
y = 0
m = 100
while m<x:
    m = 1.01*m
    y = y+1
print(y)
# Judge status: Accepted
k = int(input())
a,b = map(int,input().split())
if ((b//k)*k >= a):
  print("OK")
else:
  print("NG")
# Judge status: Accepted
int_a = int(input())
str_s = input()

if int_a >=3200:
    print(str_s)
else:
    print('red')
# Judge status: Wrong Answer
s = input()
n = len(s)

ans = 0
for c in s:
  if c != '9':
    break
else:
  print(n * 9)
  exit(0)

if n == 1:
  print(s)
else:
  print(int(s[0])-1 + 9 * (n - 1))
# Judge status: Accepted
import numpy as np
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
bs = [int(input()) for _ in range(N)]

A = np.array([A1, A2, A3])
mask = np.zeros_like(A)
for b in bs:
    mask += (A==b).astype(int)

mask = mask>0
if np.any(np.all(mask, axis=0)):
    print('Yes')
elif np.any(np.all(mask, axis=1)):
    print('Yes')
elif np.all(np.diag(mask)):
    print('Yes')
elif np.all(np.diag(mask[::-1])):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))

s = 0
for i in range(1,len(a)):
  if a[i-1]>a[i]:
    s+=1
  if a[i-1]-a[i]>1:
    s+=2
    
if s>=2:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
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()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
l = p[:X] + q[:Y]
l.sort()
print(l)
for i in range(min(C,X+Y)):
    if r[i] > l[i]:
        l[i] = r[i]
print(sum(l))
# Judge status: Wrong Answer
S = input()

N = len(S) + 1
t = [0] * N
for i in range(N - 1):
    if S[i] == '<':
        t[i + 1] = t[i] * 1
for i in range(N - 2, -1, -1):
    if S[i] == '>':
        t[i] = max(t[i], t[i + 1] + 1)
print(sum(t))
# Judge status: Wrong Answer
s = input()
n = len(s) // 2 + 1
a = s.count('a')
b = s.count('b')
c = s.count('c')
if a >= n or b >= n or c >= n:
    print('NO')
else:
    print('YES')
# Judge status: Wrong Answer
A, B, K= list(map(int, input().split()))

if A>= K:
  print(A-K, end=" ")
  print(B)
else:
  print(0, end=" ")
  print(B-(K-A))
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]
A.sort(reverse = True)
ans = A[0]
cnt = 2
for i in range(1, N):
    for j in range(2):
        cnt += 1
        if cnt > N: break
        ans += A[i]

print(ans)
# Judge status: Accepted
a,b,c,d = map(int, input().split())
print('Yes' if abs(a-b)<=d and abs(b-c)<=d or abs(a-c)<=d else 'No')
# Judge status: Accepted
p,s=print,sum;n,*a=map(int,open(0).read().split());t=s(a);p(s([w:=1]+[exit(p(-1))if(w:=min(2*(w-q),t:=t-q))<0 else w for q in a]))
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
L_max = L.pop(L.index(max(L)))
L_sum = sum(L)
if L_max < L_sum:
  print('Yes')
else: print('No')