peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
S=input()

if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print("bad")
else:
    print("good")
# Judge status: Accepted
a,b=input().split()

from decimal import *
getcontext().prec = 100
a=Decimal(a)
b=Decimal(b)
print(int(a*b))
# Judge status: Accepted
from collections import deque
Sa = deque([s for s in str(input())])
Sb = deque([s for s in str(input())])
Sc = deque([s for s in str(input())])

def solve(turn):
  que = []
  if turn == 'a':
    que = Sa
  elif turn == 'b':
    que = Sb
  elif turn == 'c':
    que = Sc
  if len(que) > 0:
    return que.popleft()
  else:
    return False

this_turn = 'a'
while True:
  next_turn = solve(this_turn)
  if next_turn == False:
    print(this_turn.upper())
    break
  else:
    this_turn = next_turn
# Judge status: Accepted
import math
x, y = map(int,input().split())

print(math.floor(x + (y/2)))
# Judge status: Wrong Answer
list=[1, 1, 1, 1, 1]
for i in range(1, 7):
  list.append(6**i)
for j in range(1, 7):
  list.append(9**i)
sorted(list, reverse=True)
N=int(input())
count=0
for i in list:
  if i < N:
    N=N-i
    count+=1
  if i == N:
    count+=1
    print(count)
# Judge status: Accepted
import math

ans=1000000000000000
n=int(input())
for i in range(1,int(math.sqrt(n))+2):
    if n%i==0:
        tmp = (i-1)+(int(n//i)-1)
        ans = min(tmp,ans)

print(ans)
# Judge status: Wrong Answer
import heapq
n, m = map(int, input().split())
d = []
heapq.heapify(d)
for _ in range(n):
    a, b = map(int, input().split())
    heapq.heappush(d, (-b, -a))

cnt = m
ans = 0
while True:
    hp =  heapq.heappop(d)
    if hp[1]*(-1) <= cnt:
        ans += (hp[0]*(-1))
        cnt -= 1
    
    if cnt == 0 or (not d):
        break
      
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())

if a % 2 == 0 or b % 2 == 0 or c % 2 == 0: print(0)
else:
  square = a*b*c/max(a,b,c)
  print(int(square))
# Judge status: Wrong Answer
import itertools

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

count = 0
p_count = 0
q_count = 0

for v in itertools.permutations(sorted(p), n):
    if list(v) == p:
        p_count = count
    elif list(v) == q:
        q_count = count

    count += 1

print(abs(p_count - q_count))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
# @0~N-1, !N,N+1,!N+2,N+3,!N+4, ... ,!N+N=2N
a = a[N::2]
print(sum(a))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

A.sort()

dig = 0
a = A[0]
while a >= 10:
    a = a // 10
    dig += 1

ans = 2
for i in range(N):
    b = A[i] // 10 ** dig
    if b % 2 == 1:
        ans = 1
        break

print(ans * 10 ** dig)
# Judge status: Accepted
N = int(input())
As = [input() for _ in range(N)]
M = int(input())
Bs = [input() for _ in range(M)]
c = max([As.count(a) - Bs.count(a) for a in As])
print(0 if c < 0 else c)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(a*b*c/2)
# Judge status: Wrong Answer
import math
a,b,x = map(int,input().split())
def f(t):
    t = math.radians(t)
    if a * math.tan(t) <= b:
        return a**2 * b - a**2 * math.tan(t) / 2
    else:
        return b**2 / math.tan(t) * a / 2
tmax = 90
tmin = 0
for i in range(10**5):
    tmid = tmin + (tmax-tmin) / 2
    if f(tmid) < x:
        tmax = tmid
    else:
        tmin = tmid
print(tmid)
# Judge status: Wrong Answer
n,*s=open(0).read().split()
t=set(sorted(s))
c=[0]*len(t)
for i,a in enumerate(t):
  c[i]=s.count(a)
m=max(c)
for i,a in zip(c,t):
  if i==m:
    print(a)
# Judge status: Accepted
a,b=map(int,input().split())
if a>=13:
    print(b)
if a<=12 and a>=6:
    print(int(b/2))
if a<=5:
    print(0)
# Judge status: Wrong Answer
n = int(input())
h = [int(xi) for xi in input().split()]

step =0
mstep = 0
for xi in range(n-1):
    if h[xi]>=h[xi+1]:
        step +=1
        # print("ok")
    else:
        if mstep<step:
            mstep = step
            step = 0
        # print("ng")
if mstep<step:
    mstep = step
print(mstep)
# Judge status: Wrong Answer
X = int(input())

n = 100
year_count = 0

while n < X:
    # n = int(n * 1.01)
    n *= 1.01
    n = int(n)
    year_count += 1

print(year_count)
# Judge status: Wrong Answer
cc = [list(map(int, input().split())) for i in range(3)]
tc = [sum(x) for x in cc]

if sum(tc) % 3 != 0:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
N, M = map(int, input().split())
if 2 * N > M:
  print(M // 2)
else:
  C = M // 2
  n = (C - N) // 2
  print(max(min(N+n-1, C-n+1), min(N+n, C-n), min(N+n+1, C-n-1)))
# Judge status: Accepted
S = list(input())
L = len(S)

for i in range(0, 1 << L-1):
    f = S[0]
    ans = int(S[0])
    for j in range(L-1):
        if (i >> j) & 1:
            f += "+"
            f += S[j+1]
            ans += int(S[j+1])
        else:
            f += "-"
            f += S[j+1]
            ans -= int(S[j+1])
    if ans == 7:
        print(f, "=7", sep="")
        exit()
# Judge status: Wrong Answer
n=int(input())
l=[[0]*9]*9
for  i in range(1,n):
  if i%10:
    l[int(str(i)[0])-1][int(str(i)[-1])-1]+=1
ans=0
for i in range(9):
  for j in range(9):
    ans+=l[i][j]*l[j][i]
print(ans)
# Judge status: Accepted
n,d = map(int, input().split())
arr = []
for i in range(n):
  arr.append(list(map(int, input().split())))
res = 0
for i in range(n-1):
  for j in range(i+1,n):
    dist = 0
    for k in range(d):
      dist += (arr[i][k] - arr[j][k])**2
    if dist == float(int(pow(dist,1/2))**2):
      res += 1
print(res)
# Judge status: Wrong Answer
X, K = map(int, input().split())
lis = list()

if X == 1:
    lis.append(K)
else:
    for i in range(K - X +1,K + X -1):
        lis.append(i)

for j in lis:
    print(j,end=" ")
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

C = S()

print(chr(ord(C)+1))
# Judge status: Wrong Answer
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

if n % 2 == 1:
    info = sorted(info)
    l = info[n // 2][0]
    info = sorted(info)[::-1]
    r = info[n // 2][1]
    print(r - l + 1)

else:
    info = sorted(info)
    l, lmax = info[n // 2 - 1]
    info = sorted(info)[::-1]
    rmin, r = info[n // 2 - 1]
    length = []
    for i in range(n):
        length.append(min(r, info[i][1]) - max(l, info[i][0]) + 1)

    length = sorted(length, reverse=True)
    print(length[0] + length[1] - 1)
# Judge status: Wrong Answer
n = int(input())
b = list(map(int,input().split()))

result = b[0] + b[-1]
for i in range(len(b)-2):
    c = [b[i+1],b[i+2]]
    result += min(c)
if n == 3:
    result = b[0]*2 + b[1]

print(result)
# Judge status: Accepted
from math import ceil
n=int(input())
print(ceil(n/2))
# Judge status: Accepted
X = int(input())
s1, a = divmod(X, 500)
s2 = a // 5
print(s1*1000+s2*5)
# Judge status: Accepted
s=input()
if s[1]=="B":
    print("ARC")
else:
    print("ABC")
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''


def main():
    S = input()
    s = len(S)
    out = "x" * s
    print(out)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N,L=map(int,input().split())
s=[]
for i in range(1,N+1):
  s.append(L+i-1)
s.sort(key=lambda x: abs(x))
del s[0]
print(sum(s))
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
m=sorted([a-i for i,a in enumerate(l, start=1)])
b1,b2=m[n//2],m[n//2-1]
print(min(sum([abs(a-b1) for a in m]),sum([abs(a-b2) for a in m])))
# Judge status: Accepted
import math

def resolve():
    _,K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    start = 0
    end = 10**9

    while end - start > 1:
        cnt = 0
        mid = (start + end) // 2
        for a in A:
            cnt += math.ceil(a/mid) - 1
        if cnt <= K:
            end = mid
        else:
            start = mid

    print(end)
    
resolve()
# Judge status: Accepted
date=input()
date=list(date)
if date[2]==date[3] and date[4]==date[5]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())

def Checker(sum, x):
    sum =  0
    while x > 0:
        sum += x % 10
        x = x // 10
    return sum

sum_list = []
for a in range(1, n):
    b = n - a
    sum_a = 0
    sum_b = 0
    
    y = Checker(sum_a, a)+ Checker(sum_b, b)
    sum_list.append(y)

print(min(sum_list))
# Judge status: Accepted
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k]+"...")
# Judge status: Wrong Answer
N = int(input())

# 1+2+3+4+...+(N-2)+(N-1)+N
# N+(N-1)+(N-2)+...+4+3+2+1
# 上と下を足し算して、２で割る

a = N+1
b = N

print( a * b / 2 )
# Judge status: Accepted
n, m = [int(i) for i in input().split(' ')]
s = sum(int(i) for i in input().split(' '))
x = max(n - s, -1)
print(x)
# Judge status: Accepted
X, Y =  map(int, input().split())
cnt = 0
while X <= Y:
    X *= 2
    cnt += 1
else:
    print(cnt)
# Judge status: Accepted
n,m = map(int,input().split())
if(m>=n):   print("unsafe")
else:   print("safe")
# Judge status: Accepted
import math
h = int(input())
w = int(input())
n = int(input())

m = max(h, w)
answer = math.ceil(n / m)
print(answer)
# Judge status: Wrong Answer
import math 

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

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

print(math.ceil(n/k))
# Judge status: Accepted
def main():

    N = int(input())

    d = [2 for _ in range(N+1)]
    d[1] = 1

    # v = int(math.sqrt(N))
    for i in range(2, N//2+1):
        for j in range(i+i, N+1, i):
            d[j] += 1
            # if j//i > v: d[j] += 1

    ans = 0
    for i in range(1, N+1):
        ans += i * d[i]
    return ans

if __name__ == '__main__':
    print(main())
# Judge status: Wrong Answer
from itertools import combinations


N = int(input())
S = input()

chars = set()
cnt = {}
for s in S:
    if s not in chars:
        chars.add(s)
        cnt[s] = 1
    else:
        cnt[s] += 1

ans = N
r = 2
chars = list(chars)
while r <= len(chars):
    combs = combinations(chars, r)
    for comb in combs:
        res = 1
        for c in comb:
            res *= cnt[c]
        ans += res
    r += 1

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

flag = True
px, py = 0, 0
for i in range(n):
    t, x, y = txy[i]
    d = abs(x-px) + abs(y-py)
    if d <= t:
        if d % 2 != t % 2:
            flag = False
    else:
        flag = False

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())

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

num_4 = 0
num_2 = 0
num_odd = 0

for i in A:
    if i % 4 == 0:
        num_4 += 1
    elif i % 2 == 0:
        num_2 += 1

num_odd = n - num_2 - num_4

if n - num_4*2 == num_2 or n - num_4 * 2 == 1 or n - num_4 * 2 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
n=len(s)
if s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1] and s[(n+3)//2-1::]==s[(n+3)//2-1::][::-1]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,M = map(int,input().split())
if N != 0 and M != 0:
  A = N*(N-1)+M*(M-1)
elif N == 0:
  A = M*(M-1)
elif M == 0:
  A = N*(N-1)
print(int(A/2))
# Judge status: Accepted
a, b, c = map(int,input().split())

print(len({a,b,c}))
# Judge status: Wrong Answer
k, a, b = map(int, input().split())
if k > a+1 and b > a:
    x = 1 + k
    t = (k-a+1)//2
    y = t * (b-a) + (k-t*2) + 1
    print(y)
    exit()
else:
    z = 1 + k
    print(z)
# Judge status: Accepted
import sys
from collections import  Counter
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    S = input()
    count = Counter(S)
    count['a'] += 0
    count['b'] += 0
    count['c'] += 0
    if max(count.values()) - min(count.values()) <= 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1, N+1):
    n = N // i
    ans += n*(2*i + (n-1)*i)//2
print(ans)
# Judge status: Accepted
x = int(input())
print(x // 11 * 2 + (x % 11 > 6) + (x % 11 > 0))
# Judge status: Accepted
N = int(input())
an = list(map(int, input().split()))

set_an = set(an)

print("YES" if len(set_an) == N else "NO")
# Judge status: Accepted
import sys
from itertools import accumulate

input = sys.stdin.readline


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

    cumsum_A = list(accumulate(A))
    sum_A = sum(A)

    ans = float("inf")
    for i in range(N - 1):
        # cost = abs((sum_A - cumsum_A[i]) - cumsum_A[i])
        cost = abs(sum_A - 2 * cumsum_A[i])
        if cost < ans:
            ans = cost

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,k=map(int,input().split())
a=list(map(int,input().split()))
ix=a.index(1)
i=math.ceil((n-k)/(k-1))+1
print(i)
# Judge status: Accepted
print('red'if int(input())<3200 else input())
# Judge status: Wrong Answer
s=input()

if s == 'RRR':
    print(3)
elif s.count('RR') == 1:
    print(2)
elif s.count('R') > 1:
    print(1)
else:
    print(0)
# Judge status: Accepted
N, K = map(int, input().split())
hate = set(map(str, input().split()))
Nos = {str(i) for i in range(10)}
while not set(list(str(N))) & hate == set():
  N += 1
print(N)
# Judge status: Accepted
N = int(input())
scarfs = list(map(int, input().split()))
xor_sum = scarfs[0]
for i in range(1, N):
    xor_sum = xor_sum ^ scarfs[i]

for scarf in scarfs:
    print(xor_sum ^ scarf, end=' ')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
# C = reversed(sorted(Counter(A)))
C = Counter(A)
x = None
# for k, v in C.items():
for k, v in reversed(sorted(C.items())):
	if v >= 4:
		if x:
			print(k * x)
			exit()
		else:
			print(k ** 2)
			exit()
	elif v >= 2:
		if x:
			print(k * x)
			exit()
		else:
			x = k
else:
	print(0)
# Judge status: Wrong Answer
K  = int(input())
A,B = map(int,input().split())

if B-A>=K-1:
    print("OK")
elif A%K > B%K:
    print("OK")
else:
    print("NG")
# Judge status: Accepted
import math
a,b,h,m = map(float, input().split())
rot = 5.5 * (60.0*h + m)
ang = rot%360
rad = ang * math.pi / 180
cal = a ** 2 + b ** 2 - 2 * a * b * math.cos(rad)
ans = math.sqrt(cal)
print(ans)
# Judge status: Accepted
listanm = []

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

for x in range(n):
    listanm.append(0)

for c in range(m):
    a,b = map(int,input().split())
    listanm[a-1]+=1
    listanm[b-1]+=1
for g in listanm:
    print (g)
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if k>=n:
    print(n*x)
else:
    print(k*x+(n-k)*y)
# Judge status: Accepted
s = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odd:
            print('No')
            exit()
    else:
        if s[i] not in even:
            print('No')
            exit()
print('Yes')
# Judge status: Wrong Answer
x, y = map(int, input().split())

b = y - 2 * x
a = x - b

ans = "Yes" if (a >= 0 and b >= 0) else "No"
print(ans)
# Judge status: Wrong Answer
import math
x,y=map(int,input().split())
print(int(math.log2(y//x))+1)
# Judge status: Accepted
k, a, b = map(int, input().split())

if b - a <= 2:
    print(k + 1)
else:
    k = k - (a - 1)
    cnt = a

    ab = k // 2
    cnt += (b - a) * ab + k % 2
    print(cnt)
# Judge status: Accepted
X,Y,Z = map(int,input().split())

print((X-Z)//(Y+Z))
# Judge status: Accepted
N,A,B = (int(X) for X in input().split())
Count = 0
for T in range(1,N+1):
    if A<=sum(int(X) for X in list(str(T)))<=B:
        Count += T
print(Count)
# Judge status: Accepted
def solve(k, a, b):
    for x in range(a, b+1):
        if x % k == 0:
            return True
    return False


if __name__ == "__main__":
    k = int(input())
    a, b = map(int, input().split())
    print("OK" if solve(k, a, b) else "NG")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

s = 0
for i in range(n):
  s += a[i]
  #sはaの和

t = 0
for i in range(n):
  t += a[i]**2
  #tはaの2乗和

ans = int(((s**2 - t)/2) % (10**9 + 7))
print(ans)
# Judge status: Wrong Answer
a = int()
b = int()
wa_list = []
n = int(input())
for a in range(n+1):
		if b == n - a:
			wa_list.append(sum(map(int, list(str(a)))) + sum(map(int, list(str(b)))))
print(min(wa_list))
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
m = max(a, b, c)

for i in range(k):
  m *= 2
  
print(sum([a, b, c]) - max(a, b, c) + m)
# Judge status: Wrong Answer
import math


num = int(input())
ans = 0

for a in range(num):
    for b in range(num):
        for c in range(num):
            ans += math.gcd(math.gcd(a,b), c)

print(ans)
# Judge status: Wrong Answer
s=list(input())
result=0
for i in s:
  if i=='0':
    result+=1
print(result)
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]
A=sorted(A)
 
ans=0
cnt=1
tmp=A[0]
 
for i in range(1,N):
    if A[i]==tmp:
        cnt+=1
    elif A[i]!=tmp and cnt%2!=0:
        cnt=1
        ans+=1
    tmp=A[i]
if cnt%2 ==1:
  ans+=1
print(ans)
# Judge status: Wrong Answer
n = int(input())

d = {}
for i in range(n):
    a = int(input())
    if a in d:
        d[a] ^= 1
print(sum(d.values()))
# Judge status: Wrong Answer
from math import sqrt
X = int(input())
flag = 0
ans = X 
while(flag == 0):
  for i in range(int(sqrt(ans))):
    if(ans % (i + 2) == 0):
      ans += 1
      flag = 0
      break
    flag = 1
print(ans)
# Judge status: Accepted
n = int(input())
print(sum([i for i in range(1, n+1)]))
# Judge status: Accepted
import math
n = int(input())
e = [0 for _ in range(n)]
for i in range(n):
    for j in range(i,n,i+1):
        e[j] += 1
ans = 0
for i in range(n):
    ans += (i+1) * e[i]
print(ans)
# Judge status: Accepted
S = input()
str_list = list(S)
p = len(S) - 1

for i in range(2 ** p):
  ans = int(str_list[0])
  sentence = S[0]
  for j in range(p):
    if (i >> j) & 1:
      ans += int(str_list[j+1])
      sentence += "+"+S[j+1]
    else:
      ans -= int(S[j+1])
      sentence += "-"+S[j+1]
  if ans ==7:
    print(sentence+"=7")
    break
# Judge status: Wrong Answer
A, B = map(int,input().split())
if A <= 5:
    print(0)
elif 6 <= A <= 12:
    print(B/2)
else:
    print(B)
# Judge status: Accepted
N, M = map(int, input().split())
ac = 0
wa = 0
arr = [0] * N
if M == 0:
  print("0 0")
  exit()
  
for i in range(M):
  p, s = list(input().split())
  p = int(p)
  if arr[p-1] != "AC":
    if s == "AC":
      wa += arr[p-1]
      arr[p-1] = "AC"
      ac += 1
    else:
      arr[p-1] += 1
print(ac, wa)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
m1=min(a)
a.sort(reverse=True)
for i in range(n-1):
    for j in range(i,n):
        if m1==1:
            break
        else:
            count=a[i]%a[j]
            if m1>count and count!=0:
                m1=count

print(m1)
# Judge status: Wrong Answer
import itertools

N = int(input())
S = list(input())

a = []
for i in range(1, N):
    for v in itertools.combinations(S, i):
        c = set(v)
        if len(c) == len(v):
            a.append(v)
        
print(len(a))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N-1):
    if i == 0:
        ans += A[i]
    else:
        ans += A[1+(i-1)//2]
print(ans)
# Judge status: Accepted
xs = list(map(int, input().split()))
print(xs.index(0)+1)
# Judge status: Accepted
import sys

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

def mi():
    return map(int, input().split())

def ii():
    return int(input())


def main():
    N = ii()
    a = [ii() for i in range(N)]
    now = 0
    for i in range(N+1):
        if now == 1:
            print(i)
            return
        now = a[now]-1
    print(-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N,Q = map(int,input().split())
S = input()
AC = [0]*N
cnt = 0
for i in range(1,N):
    if S[i-1:i+1] == 'AC':
        cnt += 1
    AC[i] = cnt
        
for i in range(Q):
    l,r = map(int,input().split())
    print(AC[r-1]-AC[l-1])
# Judge status: Wrong Answer
N = int(input())
ans = 0

for i in range(N):
    if i%3 != 0 and i%5 != 0:
        ans += i

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

if len(S) <= K:
  print(S)
else:
  print(S[:K] + '...')
# Judge status: Accepted
def main():
    X = [int(x) for x in input().split()]
    for i,x in enumerate(X):
        if x == 0:
            print(i+1)
            return

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
ans = S
if S[-1] == 's':
    ans += 'es'
else:
    ans += 's'

print(ans)
# Judge status: Accepted
N,D = map(int,input().split())
L = [list(map(int,(input().split()))) for _ in range(N)]

ans = 0
for i in range(N):
    d = (L[i][0]**2 + L[i][1]**2) ** 0.5
    if d <= D:
       ans += 1
print(ans)
# Judge status: Wrong Answer
arr = input()
if not 'B' in arr:
    print(arr)
else:
    arr = ''.join(reversed(arr))
    print(''.join(reversed(arr[:arr.index('B')])))
# Judge status: Accepted
# -*- coding: utf-8 -*-
# 入力
S = input()
# 演算
N = len(S)
if S[0:int((N-1)/2)] == S[int((N+3)/2)-1:N]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
num = (int(input()))
ans1 = 0
ans2 = 0
while num >= 500:
    ans1 += 1
    num -= 500

while num >= 5:
    ans2 += 1
    num -= 5

print((ans1*1000)+(ans2*5))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.reverse()
b.reverse()
ans = 0
capacity = 0
for i in range(N):
    ans += min(b[i] + capacity, a[i])
    capacity = max(b[i] - max(a[i] - capacity, 0), 0)
ans += min(a[-1], capacity)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
ans=[0 for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    ans[a]+=1
    ans[b]+=1
for i in range(n):
    print(ans[i])
# Judge status: Wrong Answer
N_ = int(input())

A_ = list(map(int,input().split()))
#A_.remove(1)
#print(A_)
def xC(num):
    return (num * (num - 1)) //2

def Re_(reA,t):
    Dup = []
    num = 0
    #print(reA)
    for i in range(len(reA)):
        if Dup.count(reA[i]) == 0:
            Dup.append(reA[i])
        else:
            pass
    for i in range(len(Dup)):
        num += xC(reA.count(Dup[i]))
    return num
# Judge status: Wrong Answer
A, B, C, K = map(int,input().split())
if K <= A:
    print(K)
elif K <= A+B:
    print(A)
else:
    print(A + C*-1*(K-A-B))
# Judge status: Accepted
N,K=map(int,input().split())
A = list(map(int,input().split()))


s0=A[0]


for i in range(N-K):
    s1=A[K+i]
    if s1>s0:
        print('Yes')
    else:
        print('No')
    s0=A[i+1]
# Judge status: Accepted
n = int(input())

if n == 0:
  print(2)
elif n == 1:
  print(1)
else:

    l0 = 2
    l1 = 1
    result = 0
    for i in range(n-1):
      result = l0+l1
      l0 = l1
      l1 = result

    print(result)
# Judge status: Accepted
N=int(input())
a=list(map(int, input().split()))
ans = 0
for i in range(N):
  if i%2==0 and a[i]%2==1:
    ans += 1
print(ans)
# Judge status: Accepted
s = input()

s = list(s)
sowth = s.count('S') if 'S' in s else 0
east  = s.count('E') if 'E' in s else 0
north = s.count('N') if 'N' in s else 0
west  = s.count('W') if 'W' in s else 0

if (west != 0 and east != 0 and sowth == 0 and north == 0) or\
    (sowth != 0 and north != 0 and west == 0 and east == 0) or\
    (sowth != 0 and north != 0 and west != 0 and east != 0):
    print('Yes')
else:
    print('No')