Harryxun/stf_run huggingface dataset:
#! -*- coding: utf -*-

import math

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

for i in range(n-1):
    monsters[i + 1] = math.gcd(monsters[i], monsters[i + 1])

print(monsters[-1])


### FIXED CODE ###

#! -*- coding: utf -*-

import fractions

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

for i in range(n-1):
    monsters[i + 1] = fractions.gcd(monsters[i], monsters[i + 1])

print(monsters[-1])
a = input()
print((((a-1)//111)+1)*111)

### FIXED CODE ###

a = int(input())
print((((a-1)//111)+1)*111)
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: str(sys.stdin.buffer.readline().rstrip())
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

s = rr()
k = ri()
cnt = 0
for i in range(len(s)-1):
  if len[i] == len[i+1]:
    cnt += 1
print(cnt*k)



### FIXED CODE ###

import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

s = rr()
k = ri()
cnt = 0
i = 0
if len(set(s)) == 1:
  print(int(len(s)*k/2))
  exit()
while i < len(s)-1:
  if s[i] == s[i+1]:
    cnt += 1
    i += 1
  i += 1
cnt1 = 0
i1 = 0
s *= 2
while i1 < len(s)-1:
  if s[i1] == s[i1+1]:
    cnt1 += 1
    i1 += 1
  i1 += 1
print((cnt1 - cnt)*(k-1) + cnt)
n,k = map(int,input().split())

mm=0
for i in range(1,n+1):
    if i%k==0:
        mm+=1
    if i%k==k//2 and k%2==0:
        mm+=1

print(C(mm**3))

### FIXED CODE ###

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

mm1=0
mm2=0
for i in range(1,n+1):
    if i%k==0:
        mm1+=1
    if i%k==k//2 and k%2==0:
        mm2+=1

print(mm1**3+mm2**3)
num = int(input())
i = [int(input()) for _ in range(num)]

count_dict = {}
for ele in i:
  if ele not in count_dict:
    count_dict[ele] = 1
  else:
    count_dict[ele] += 1

max_count = max(count_dict.values())
max_str = [a for a in count_dict if count_dict[a] == max_count]
for string in sorted(max_str):
  print(string)

### FIXED CODE ###

num = int(input())
i = [input() for _ in range(num)]
 
count_dict = {}
for ele in i:
  if ele not in count_dict:
    count_dict[ele] = 1
  else:
    count_dict[ele] += 1
 
max_count = max(count_dict.values())
max_str = [a for a in count_dict if count_dict[a] == max_count]
for string in sorted(max_str):
  print(string)
import math

N, X = map(int, input().split())
X_lst = list(map(int, input().split()))

if len(X_lst) == 1:
    print(abs(X_lst[0] - X))
    exit()

u = 0
if X_lst[0] == X:
    u = float('inf')

for i, x in enumerate(X_lst[1:], start=1):
    if x == X:
        u = float('inf')

    if X_lst[i - 1] < X < x:
        u = [X - u, x - X]

    if i == 1:
        g = X_lst[1] - X_lst[0]
    else:
        g = math.gcd(g, x - X_lst[i - 1])


if u == 0:
    u = [X - X_lst[-1]]
elif u != float('inf'):
    g = max(math.gcd(g, u[0]), math.gcd(g, u[1]))

print(g)


### FIXED CODE ###

import math

N, X = map(int, input().split())
X_lst = list(map(int, input().split()))

if len(X_lst) == 1:
    print(abs(X_lst[0] - X))
    exit()

u = 0
if X_lst[0] == X:
    u = float('inf')

for i, x in enumerate(X_lst[1:], start=1):
    if x == X:
        u = float('inf')

    if X_lst[i - 1] < X < x:
        u = [X - X_lst[-1], x - X]

    if i == 1:
        g = X_lst[1] - X_lst[0]
    else:
        g = math.gcd(g, x - X_lst[i - 1])


if u == 0:
    u = [X - X_lst[-1]]
elif u != float('inf'):
    g = max(math.gcd(g, u[0]), math.gcd(g, u[1]))

print(g)
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

x, y = map(int, input().split())

if (2*x-y) % 3 == 0:
    b = (2*x-y)/3
    a = x-2*b
    if a<0:
        print(0)
        exit()
else:
    print(0)
    exit()

print(int(comb(a+b, a)%(1e9+7)))


### FIXED CODE ###

p = 10**9+7
def nCr(n,r):
    if r*2>n:
        return nCr(n,n-r)
    else:
        a = b = 1
        for i in range(r):
            a = a * (n - i) % p
            b = b * (r - i) % p
        return (a * pow(b,p-2,p)) % p

x, y = map(int, input().split())

if (2*x-y) % 3 == 0 and (2*y-x) % 3 == 0 and (2*x-y)>=0 and (2*y-x)>=0:
    b = (2*x-y)//3
    a = x-2*b
else:
    print(0)
    exit()

print(int(nCr(a+b, a)))
A = int(input())
B = int(input())
print('LESS' if A < B else 'GREATER' if A > B else 'EQUAL')

### FIXED CODE ###

s1, s2, s3 = input().split()


print((s1[0] + s2[0] + s3[0]).upper())
a, b = map(int, input().split())
s = input()

if s[a+1] == "-":
    s2 = s[:a+1] + s[a+2:]
    for i in range(a+b+1):
        if s2[i] not in ["0","1","2","3","4","5","6","7","8","9"]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if s[:a].isdecimal() and s[a]=="-" and s[a+1:].isdecimal():
    print("Yes")
else:
    print("No")
from copy import copy
n=int(input())
a=[int(input()) for _ in range(n)]
b=copy(a)
ans1=0
for i in range(n-1):
  ans1+=min(a[i],a[i+1])
  k=max(a[i]-a[i+1],0)
  a[i+1]=max(a[i+1]-a[i],0)
  a[i]=k
for i in a:
  ans1+=i//2
ans2=0
for i in range(n-1,0,-1):
  ans2+=min(b[i],b[i-1])
  k=max(b[i]-b[i-1],0)
  b[i+1]=max(b[i-1]-b[i],0)
  b[i]=k
for i in b:
  ans2+=i//2
print(max(ans1,ans2))

### FIXED CODE ###

from copy import copy
n=int(input())
a=[0]+[int(input()) for _ in range(n)]
ans=0
for i in range(n):
  ans+=(a[i+1]+a[i])//2
  if a[i+1]:a[i+1]=(a[i+1]+a[i])%2
print(ans)
import math

print(int(math.sqrt(int(input())))**2)


### FIXED CODE ###

ls = list(map(lambda x: int(x), input().split()))
if abs(ls[0] - ls[2]) <= ls[3] or (abs(ls[0] - ls[1]) <= ls[3] and abs(ls[1] - ls[2]) <= ls[3]):
    print("Yes")
else:
    print("No")
s = input()
t = input()
 
if len(s) + 1  == len(t) and s in t:
  print(Yes)
  
else :
  print(No)

### FIXED CODE ###

s = input()
t = input()

if s == t[0:-1]:
  
  print('Yes')
  
else:
  print('No')
x=input()
a=[1]
for i in range(1,len(x)):
    if x[i]==x[i-1]:
        a[-1]+=1
    else:a+=[1]
ans=0    
if x[0]=="T":
    ans+=a.pop(0)
if x[-1]=="S":
    ans+=a.pop(-1)
    
while len(a)>1:
    a=[a[i]-a[i+1] for i in range(0,len(a),2)]
    a=[i for i in a if i!=0]
    if a:
        if a[0]<0:
            ans-=a.pop(0)
    if a:
        if a[-1]>0:
            ans+=a.pop(-1)
    a=[abs(i) for i in a if i!=0]
print(ans+abs(a[0]) if a else ans)

### FIXED CODE ###

a=[]
for i in input():
    if i=="S":
        a+=i
    
    if a:
        if i=="T" and a[-1]=="T":
            a+=i
        if i=="T" and a[-1]=="S":
            a.pop(-1)
    elif i=="T" and len(a)==0:
        a+=i    
print(len(a))
n=int(input())

if n<10:
  print(n)
elif n<100:
  print(9)
elif n<1000:
  print(n-90)
elif n<10000:
  print(909)
else n<100000:
  print(n-9090)
else:
  print(90909)

### FIXED CODE ###

n=int(input())

if n<10:
  print(n)
elif n<100:
  print(9)
elif n<1000:
  print(n-90)
elif n<10000:
  print(909)
elif n<100000:
  print(n-9090)
else:
  print(90909)
import sys
import math

def main():
    a, b, k = map(int, sys.stdin.readline().split())
    query_range = range(a, b + 1)
    
    query_range = list(query_range)
    print('aaa')
    exit()

    if a == b:
        res = query_range
    elif k >= math.ceil((b - a + 1) / 2):
        res = query_range
    else:
        res = query_range[:k] + query_range[-k:]

    for i in res:
        print(i)
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

a, b, k = map(int, sys.stdin.readline().split())

def main():
    if k >= b - a + 1:
        res = list(range(a, b+1))
    else:
        res = set(range(a, a+k)) | set(range(b, b-k, -1))
        res = sorted(res)
    return res

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')
import numpy as np
K, N = map(int, input().split())
A = list(map(int, input().split()))
D = np.zeros((N,N))
for i in range(N-1):
  for j in range(i+1,N):
    a = abs(A[i]-A[j])
    D[i][j] = min(a, K-a)
print (K-np.max(D))

### FIXED CODE ###

K, N = map(int, input().split())
A = list(map(int, input().split()))
ans = min(A[-1]-A[0],K-(A[-1]-A[0]))
for i in range(N-1):
  ans = max(ans,A[i+1]-A[i])
print (K-ans)
print(input().count("1))

### FIXED CODE ###

print(input().count("1"))
import sys
a,b=map(int,input().split())

if a%2==0:
  lower1=int(a*100/8)
else:
  lower1=a*(100/8)
  upper1=int((a+1)*100/8)
  if (upper1)-int(lower1)<1:
    print(-1)
    sys.exit()
  else:
    lower1=int(lower1)+1
    if lower1=upper1:
      print(-1)
      sys.exit()
    else:
      pass
  
lower2=(b)*10
upper2=(b+1)*10

lower=max(lower1,lower2)
if lower=uppwer1:
  print(-1)
else:
  print(lower)

### FIXED CODE ###

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

if a%2==0:
  lower1=int(a*100/8)
  upper1=(a+1)*100/8
  upper1=max(lower1,int(upper1)-1)  
else:
  lower1=a*(100/8)
  upper1=int((a+1)*100/8)
  if (upper1)-int(lower1)<=1:
    print(-1)
    sys.exit()
  else:
    lower1=int(lower1)+1
    if lower1==upper1:
      print(-1)
      sys.exit()
    else:
      pass
  
lower2=(b)*10
upper2=(b+1)*10

lower=max(lower1,lower2)
upper=min(upper1,upper2)
if upper-lower<1:
  print(-1)
else:
  print(lower)
import functools
import math

N,X = map(int,input().rstrip().split())


x = list(map(int,input().rstrip().split()))
x.append(X)
x = sorted(x)
mini = x[1] - x[0]


to = []
for i in range(len(x)-1):
	to.append(x[i+1] - x[i])
	if mini > x[i+1] - x[i]:
		mini =  x[i+1] - x[i]
		

gcd = functools.reduce(math.gcd, to)
print(gcd)

### FIXED CODE ###

import numpy as np
import fractions
from functools import reduce
N,X = map(int,input().rstrip().split())
x = []
x = list(map(int,input().rstrip().split()))
x.append(X)
x.sort()


mini = []
for i in range(len(x)-1):
	mini.append(x[i+1] - x[i])
print(reduce(fractions.gcd, mini))
[a,b,c]=[int(x) for x in input().split]
if a>b and b>c:
 print("Yes")
else:
 print("No")

### FIXED CODE ###

[a,b,c]=[int(x) for x in input().split()]
if a<b<c:
 print("Yes")
else:
 print("No")
n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
    else:
        anss.append(ans)
        ans=0
import numpy as np
anss=np.array(anss)
print(anss.max())

### FIXED CODE ###

n=input()
ans=0
anss=[]
for i in range(len(n)):
    
    if n[i] == "A" or n[i] == "T" or n[i] == "G" or n[i] == "C":
        ans += 1
        anss.append(ans)
    else:
        anss.append(ans)
        ans=0

import numpy as np
anss=np.array(anss)
print(anss.max())
a = str(input())
b = str(input())
c = (b + a)
print(c)

### FIXED CODE ###

a, b = input(). split()
c = (b + a)
print(c)
a - int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
if __name__ == "__main__":
  law = 10 ** 9 + 7
  
  dest_x, dest_y = sorted(map(int, input().split()), reverse=True)
  W = H = dest_x + 1
  
  num_pattern = [[0] * W for j in range(H)]
  
  num_pattern[0][0] = 1
  
  stack = [(0, 0, 0, 0)]
  moves = [(1, 2), (2, 1)]
  
  while(stack):
    x, y, or_x, or_y = stack.pop(0)
    
    for dx, dy in moves:
      if x + dx != or_x and y + dy != or_y and 0 <= x + dx < W and 0 <= y + dy < H and x + dx >= y + dy:
        num_pattern[x + dx][y + dy] += num_pattern[x][y]
        stack.append((x + dx, y + dy, x, y))
      
  print(num_pattern[dest_x][dest_y] * 2 % law)
  pass


### FIXED CODE ###

import math
import functools

law = 10 ** 9 + 7
def mul_mod(x, y):
  return x * y % law

def prod_mod(seq):
  return functools.reduce(mul_mod, seq, 1)
#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m
  
def comb(n, k):
  return prod_mod(i for i in range(n - k + 1, n + 1)) * mod_inv(prod_mod(i for i in range(1, k + 1)), law) % law

if __name__ == "__main__":
  
  x, y = sorted(map(int, input().split()), reverse=True)
  
  if (x + y) % 3 != 0:
    print(0)
  else:
    print(comb((x + y) // 3, x - (x + y) // 3))
import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

tmp = sys.maxsize

for i in range(K):
    minNum = candles[i]
    maxNum = candles[i+K-1]

print(tmp)

### FIXED CODE ###

import sys

N, K = map(int, input().split())
candles = list(map(int, input().split()))

ans = sys.maxsize

for i in range(N-K+1):
    minNum = candles[i]
    maxNum = candles[i+K-1]
    l = abs(minNum) + abs(minNum - maxNum)
    r = abs(maxNum) + abs(maxNum - minNum)
    ans = min(ans, min(l, r))

print(ans)
list=sorted[input()]
print(*list,sep="")

### FIXED CODE ###

n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print("".join(s))
def main():
    s = input()
    l = ["K", "I", "H", "B", "R"]
    for i in range(len(l)):
        if l[i] not in s:
            print("NO")

    if s.index("KIH") == -1:
        print("NO")
        exit()

    c = 0
    ac = 0
    for i in range(len(s)):
        if c == 0:
            if s[i] == "K":
                c = 1
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 1:
            if s[i] != "I":
                print("NO")
                exit()
            c = 2
        elif c == 2:
            if s[i] != "H":
                print("NO")
                exit()
            c = 3
        elif c == 3:
            if s[i] == "B":
                c = 4
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 4:
            if s[i] == "R":
                c = 5
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 5:
            if s[i] == "A":
                ac += 1
            if ac > 1:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    s = input()
    l = ["K", "I", "H", "B", "R"]
    for i in range(len(l)):
        if l[i] not in s:
            print("NO")
            exit()

    c = 0
    ac = 0
    for i in range(len(s)):
        if c == 0:
            if s[i] == "K":
                c = 1
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 1:
            if s[i] != "I":
                print("NO")
                exit()
            c = 2
        elif c == 2:
            if s[i] != "H":
                print("NO")
                exit()
            c = 3
        elif c == 3:
            if s[i] == "B":
                c = 4
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 4:
            if s[i] == "R":
                c = 5
                ac = 0
            elif s[i] != "A":
                print("NO")
                exit()
            else:
                ac += 1
            if ac > 1:
                print("NO")
                exit()
        elif c == 5:
            if s[i] == "A":
                ac += 1
            else:
                print("NO")
                exit()
            if ac > 1:
                print("NO")
                exit()
    print("YES")


if __name__ == '__main__':
    main()
x = map(int,raw_input().split())
i = 0
while x[i] <> 0:
  print "Case %d: %d" %(i,x[i])
  i += 1

### FIXED CODE ###

i = 0
while 1:
    x = input()
    i += 1
    if x == '0':
        break
    print ('Case %s: %s' % (i,x))
x,n = map(int,input().split())
p = list(map(int,input().split()))
for i in range(50):
    pFlag = True
    mFlag = True
    for j in range(len(p)):
        if p[j] == x+i:
            pFlag = False
        if p[j] == x-i:
            mFlag = False
    if mFlag:
        a = (-1)* i
        break
    if pFlag:
        a = i
        break
print(x+a)

### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
for i in range(100):
    pFlag = True
    mFlag = True
    for j in range(len(p)):
        if p[j] == x+i:
            pFlag = False
        if p[j] == x-i:
            mFlag = False
    if mFlag:
        a = (-1)* i
        break
    if pFlag:
        a = i
        break
print(x+a)
n,m=map(int,input().split())
a=[-1 for _ in range(n)]
f=0
if n!=1:
    
    for i in range(m):
        s,c=map(int,input().split())
        if a[s-1]==-1 or a[s-1]==c:
            a[s-1]=c
        if a[s-1]!=-1 and a[s-1]!=c:
            f=1
        if s==1 and c==0:
            f=1
    for q in range(n):
        if q!=0 and a[q]==-1:
            a[q]=0
        if q==0 and a[q]==-1:
            a[q]=1

    ans=0
    for t in range(n):
        ans+=a[n-t-1]*(10**t)
    print(ans if f==0 else -1)
else:
    s,c=map(int,input().split())
    d=c
    for i in range(m-1):
        e,r=map(int,input().split())
        if d!=r:
            f=1
    print(c if f==0 else -1)
        

    


### FIXED CODE ###

n,m=map(int,input().split())
a=[-1 for _ in range(n)]
f=0
if n!=1:
    
    for i in range(m):
        s,c=map(int,input().split())
        if a[s-1]==-1 or a[s-1]==c:
            a[s-1]=c
        if a[s-1]!=-1 and a[s-1]!=c:
            f=1
        if s==1 and c==0:
            f=1
    for q in range(n):
        if q!=0 and a[q]==-1:
            a[q]=0
        if q==0 and a[q]==-1:
            a[q]=1

    ans=0
    for t in range(n):
        ans+=a[n-t-1]*(10**t)
    print(ans if f==0 else -1)
else:
    for i in range(m):
        
        s,c=map(int,input().split())
        if i==0:
            d=c
        if d!=c:
            f=1
            
    if m!=0:
        
        print(c if f==0 else -1)
    if m==0:
        print(0)
n = int(input())
a = list(map(int, input().split()))
def doit(a):
    c = {}
    for ai in a:
        c[ai] = c.get(ai, 0) + 1
    if len(c) > 3:
	return "No"
    k = list(sorted(c.keys()))
    if len(k) == 1:
	if k[0] == 0:
            return "Yes"
    if len(k) == 2:
	if k[0] == 0 and c[k[0]] * 2 == c[k[1]]:
            return "Yes"
    if len(k) == 3:
	if c[k[0]] == c[k[1]] == c[k[2]] and k[0] ^ k[1] == k[2]:
            return "Yes"
    return "No"

print(doit(sorted(a)))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
def doit(a):
    c = {}
    for ai in a:
        c[ai] = c.get(ai, 0) + 1
    if len(c) > 3:
        return "No"
    k = list(sorted(c.keys()))
    if len(k) == 1:
        if k[0] == 0:
            return "Yes"
    if len(k) == 2:
        if k[0] == 0 and c[k[0]] * 2 == c[k[1]]:
            return "Yes"
    if len(k) == 3:
        if c[k[0]] == c[k[1]] == c[k[2]] and k[0] ^ k[1] == k[2]:
            return "Yes"
    return "No"

print(doit(sorted(a)))
S = int(input())
W = int(input())
if S >= W : print('safe')
else: print('unsafe')

### FIXED CODE ###

S, W = map(int,input().split())
if S <= W :
  print("unsafe")
else:
  print("safe")
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=float('INF')
ans=-1
for i in range(n):
    ave=t-(h[i]*0.006)
    tmp=a-ave
    if tmp < 0:
        tmp*=-1
    if diff > tmp:
        diff=tmp
        ans=i+1
print(ans)p

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=1000000
for i in range(n):
    ave=t-(h[i]*0.006)
    tmp=a-ave
    if tmp < 0:
        tmp*=-1
    if diff > tmp:
        diff=tmp
        ans=i+1
print(ans)
N,K,C=map(int,input().split())
S=list(input())
if S==["o"] and K==1:
    print(1)
    exit()
#print(S)
F=[]
cnt=C
num=1
for i in range(N):
    if cnt>=C and S[i]=="o":
        F.append([num,i])
        num+=1
        cnt=0
    else:
        F.append([F[-1][0],F[-1][1]])
        cnt+=1
#print(F)
E=[]
RS=S[::-1]
cnt=C
num=1
for i in range(N):
    if cnt>=C and S[N-i-1]=="o":
        E.append([num,N-1-i])
        num+=1
        cnt=0
    else:
        E.append([E[-1][0],E[-1][1]])
        cnt+=1
E=E[::-1]
#print(E)
ans=[]
for i in range(N):
    if i==0:
        if E[i+1][0]<K:
            ans.append(1)
    elif i==N-1:
        if F[i-1][0]<K:
            ans.append(N)
    else:
        cnt=F[i-1][0]+E[i+1][0]
        if E[i+1][1]-F[i-1][1]<C:
            cnt-=1
        if cnt<K:
            ans.append(i+1)
#print(ans)
if len(ans)==0:
    print("")
    exit()
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

N,K,C = map(int,input().split())
S = list(input())
F = []
maru = 0
last = -10**9
span = C
for i in range(N):
    if S[i]=="o" and span >= C:
        maru += 1
        last = i
        F.append([maru,last])
        span = 0
    else:
        span += 1
        F.append([maru,last])
#print(F)
s = S[::-1]
maru = 0
last = 10**9
span = C
E = []
for i in range(N):
    if s[i] == "o" and span >= C:
        maru += 1
        last = N-1-i
        E.append([maru,last])
        span = 0
    else:
        E.append([maru,last])
        span += 1
E = E[::-1]
#print(E)
F = [[0,-10**9]] + F + [[0,10**9]]
E = [[0,-10**9]] + E + [[0,10**9]]
#print(F)
#print(E)
ans = []
for i in range(1,N+1):
    cnt = F[i-1][0] + E[i+1][0]
    
    if S[i-1] == "o":
        if E[i+1][1] - F[i-1][1] < C:
            cnt -= 1
        if cnt == K-1:
            ans.append(i)
    #print(F[i-1],E[i+1],cnt)
for i in range(len(ans)):
    print(ans[i])
size = int(input())
sides = []
for _ in range(len):
  sides.append(int(input()))
big = max(sides)
together = sum(sides)
if(big < together):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

size = int(input())
sides = input().split()
ss = []
for x in sides:
  ss.append(int(x))
big = max(ss)
together = sum(ss)
if(big < together-big):
	print("Yes")
else:
	print("No")
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1
if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]
if nb>=k:
    ans=min(ans,b[k-1])
if nb==0:
    print(-a[-k])
    exit()
if na==0:
    print(b[k-1])
    exit()
exit()
for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)


### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)