Harryxun/stf_run huggingface dataset:
import numpy as np

n = input()

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

res = np.prod(a)

if res > 10**18 :
    print('-1')

else:
    print(res)

### FIXED CODE ###

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

print(a*b)
while True:
    name,typ=raw_input().split()
    if name=="EndOfInput" and typ=="X":break
    L=[]
    if "_" in name:
        L=name.split("_")
    elif  name[0].islower():
        temp=""
        for ch in name:
            if ch.islower():
                temp+=ch
            else:
                L.append(temp)
                temp=""
                temp+=ch
        L.append(temp)
    else:
        temp=name[0]
        for ch in name[1:]:
            if ch.islower():
                temp+=ch
            else:
                L.append(temp)
                temp=""
                temp+=ch
        L.append(temp)

    if typ=="D":
        print "_".join(map(lambda s:s.lower(),L))
    elif typ=="U":
        print "".join(map(lambda s:s.capitalize(),L))
    else:
        print L[1]+"".join(map(lambda s:s.capitalize(),L[1:]))

### FIXED CODE ###

import re
while True:
    name,typ=raw_input().split()
    if name=="EndOfInput" and typ=="X":break
    if "_" in name:
        L=name.split("_")
    else:
        L=re.findall("[A-Z][a-z]*",name[0].upper()+name[1:])

    if typ=="D":
        print "_".join(map(lambda s:s.lower(),L))
    elif typ=="U":
        print "".join(map(lambda s:s.capitalize(),L))
    else:
        print L[0].lower()+"".join(map(lambda s:s.capitalize(),L[1:]))
H,W=map(int,input().split())
a=[list(map(int,input().split())) for _ in[0]*H]
res=[]
for i in range(H):
    for j in range(W-1):
        if a[i][j]%2==1:
            a[i][j]-=1
            a[i][j+1]+=1
            res.append([i,j,i,j+1])
for i in range(H-1):
    if a[i][-1]%2==1:
        a[i][-1]-=1
        a[i+1][-1]+=1
        res.append([i,j,i+1,j])
print(len(res))
for x in res:
    print(*x)

### FIXED CODE ###

H,W=map(int,input().split())
a=[list(map(int,input().split())) for _ in[0]*H]
res=[]
for i in range(H):
    for j in range(W-1):
        if a[i][j]%2==1:
            a[i][j]-=1
            a[i][j+1]+=1
            res.append([i,j,i,j+1])
for i in range(H-1):
    if a[i][-1]%2==1:
        a[i][-1]-=1
        a[i+1][-1]+=1
        res.append([i,W-1,i+1,W-1])
print(len(res))
for a,b,c,d in res:
    print(a+1,b+1,c+1,d+1)
import itertools
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,MOD = map(int,input().split())
if N == 1:
    print(1)
    exit()
graph = [set() for _ in range(N+1)]
for _ in range(N-1):
    x,y = map(int,input().split())
    graph[x].add(y)
    graph[y].add(x)

dp_1 = [None] * (N+1)
products = [[] for _ in range(N+1)]

def dfs_1(v=1,parent=None):
    # 子ごとに、そこを黒くして適切 or 完全白
    # dp_1 + 1 の積
    x = 1
    graph[v].discard(parent)
    if graph[v]:
        arr = [dfs_1(w,v)+1 for w in graph[v]]
        L = list(itertools.accumulate(arr[:-1], lambda x,y: x*y%MOD))
        R = list(itertools.accumulate(arr[1:][::-1], lambda x,y: x*y%MOD))[::-1]
        products[v] = [x*y%MOD for x,y in zip(L,R)]
        dp_1[v] = products[v][0] * arr[0] % MOD
    else:
        dp_1[v] = 1
    return dp_1[v]

dp_1 = [0] * (N+1) # 自分を黒く塗って、子側の部分木を適切に塗る方法
dfs_1()


### FIXED CODE ###

import itertools
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,MOD = map(int,input().split())
if N == 1:
    print(1)
    exit()
graph = [set() for _ in range(N)]
for row in sys.stdin.readlines():
    x,y = map(int,row.split())
    graph[x-1].add(y-1)
    graph[y-1].add(x-1)

ldp = [None] * N
rdp = [None] * N

def dfs_1(v=0,parent=None):
    # 子ごとに、そこを黒くして適切 or 完全白
    graph[v].discard(parent)
    ldp[v] = [1] * (len(graph[v])+1)
    rdp[v] = [1] * (len(graph[v])+1)
    vals = [dfs_1(w,v)+1 for w in graph[v]]
    for i,x in enumerate(vals,1):
        ldp[v][i] = ldp[v][i-1] * x % MOD
    for i,x in enumerate(reversed(vals),1):
        rdp[v][-i-1] = rdp[v][-i] * x % MOD
    return ldp[v][-1]

dfs_1()

dp = [None] * N
q = [(0,1)]
while q:
    v,x = q.pop()
    dp[v] = x*ldp[v][-1]%MOD
    for w,L,R in zip(graph[v],ldp[v][:-1],rdp[v][1:]):
        q.append((w,x*L*R%MOD+1))

print('\n'.join(map(str,dp)))
n=int(input())
blue=[input() for _ in range(n)]
bset = set(blue)

m=int(input())
red=[input() for _ in range(m)]

print(min(0, max([blue.count(b) - red.count(b)) for b in bset]))


### FIXED CODE ###


n=int(input())
blue=[input() for _ in range(n)]
bset = set(blue)

m=int(input())
red=[input() for _ in range(m)]

print(max([max(0, blue.count(b) - red.count(b)) for b in bset]))
N,K=map(int,input().split())
S=input()
for i,m in enumerate(S):
    if m=="A":
        S[i]="A"
    if m=="B":
        S[i]="B"
    if m=="C":
        S[i]="C"
print(S)


### FIXED CODE ###

N,K=map(int,input().split())
S=input()
SS=""
for i,s in enumerate(S):
    if i==K-1:
        if s=="A":
            s="a"
        if s=="B":
            s="b"
        if s=="C":
            s="c"
    SS+=s
print(SS)
N, A, B = map(int, input().split())
ans = 'b' * A + 'r' * B
ans *= N // (A + B)
print(ans.count('b'))

### FIXED CODE ###

N,A,B=map(int,input().split())
div=N//(A+B)
mod=N%(A+B)
print(div*A+min(mod,A))
#!/usr/bin/env python3
# -*- coding:utf-8 -*-


if __name__=='__main__':
  N, K = map(int, input().split())
  sushis = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x:x[1])[::-1]

  curr = sushis[:K]
  leave = sushis[K:]
  base = lambda li: sum([l[1] for l in li])
  types = set([c[0] for c in curr])
  di = {}

  types_max = len(set([c[0] for c in sushis]))

  for i in range(len(types), K+1):
    di[str(i)] = base(curr) + i**2

    # next
    if i <= types_max:
      tdi = {}
      remove_number = -1
      for j, t in enumerate(curr[::-1]):
        if not str(t[0]) in tdi.keys():
          tdi[str(t[0])] = -j-1
        else:
          remove_number = tdi[str(t[0])]
          break
      curr.pop(int(remove_number))

      for j, l in enumerate(leave):
        if not l[0] in types:
          types.union({l[0]})
          break
      curr += [leave.pop(j)]
    else:
      break
  print(sorted(di.items(), key=lambda x:x[1])[-1][1])

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import sys
input = sys.stdin.readline

def main():
  N, K = map(int, input().split())
  sushis = [tuple(map(int, input().split())) for _ in range(N)]
  sushis.sort(key=lambda x:x[1], reverse=True)
  curr = sushis[:K]
  leave = sushis[K:]
  base = lambda li: sum([l[1] for l in li])
  types_max = len(set([c[0] for c in sushis]))
  types = set()
  dups = []

  for c in curr:
    if c[0] in types:
      dups += [c]
    else:
      types.add(c[0])
  types = set(types)

  ps = base(curr) + len(types)**2
  di = {}
  di[len(types)] = ps
  n_types = len(types) + 1
  for l in leave:
    if len(types) >= types_max:
      break
    if len(dups) == 0:
      break
    if not l[0] in types:
      dup = dups.pop()
      di[n_types] = ps - dup[1] + l[1] + n_types**2 - (n_types-1)**2
      ps = di[n_types]
      n_types += 1
      types.add(l[0])

  print(sorted(di.items(), key=lambda x:x[1])[-1][1])


if __name__=='__main__':
  main()
a, b, c = map(int, input().split)

if a + b == c or b + c == a or c + a == b:
    print('Yes')
    
else:
    print('No')

### FIXED CODE ###

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

a, b, c = seq

if a + b == c:
    print('Yes')
    
else:
    print('No')
n = int(input())
s = [sorted(list(input())) for i in range(n)]
rem  = s[0]
for i in range(1,n):
    tmp = rem[:]
    for j in s[i]:
        try:
            tmp.remove(j)
        except:
            pass
    for k in tmp:
        try:                                                                                                                                                                    
    rem.remove(k)
        except:
            pass
print(''.join(rem))

### FIXED CODE ###

n = int(input())
s = [list(input()) for i in range(n)]
ans = sorted(list(set(s[0])))
numbers = [100 for i in range(len(ans))]
for i in range(n):
  for j in range(len(ans)):
    numbers[j] = min(numbers[j], s[i].count(ans[j]))
ret = ""
for i in range(len(ans)):
  ret += ans[i]*numbers[i]
print(ret)
a,b = map(int,input().split())
print(max(A+A-1,A+B,B+B-1))

### FIXED CODE ###

a,b = map(int,input().split())
print(max(a+a-1,a+b,b+b-1))
x = input()

print(x**3)

### FIXED CODE ###

input_lines = int(input())
print(input_lines **3)
int(input())

if X >= 30:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

X = int(input())

if X >= 30:
  print("Yes")
else:
  print("No")
# a*a と aaの２パターンを探せばよい？
s = input()
n = len(s)
for i in range(n-2):
  if s[i] == s[i + 1]:
  print(i, i + 1)
  exit()
  
for i in range(n-3):
  if s[i] == s[i + 2]:
  print(i, i + 2)
  exit()
  
print(-1, -1)


### FIXED CODE ###

# a*a と aaの２パターンを探せばよい？
s = input()
n = len(s)
for i in range(n-1):
  if s[i] == s[i + 1]:
    print(i + 1, i + 2)
    exit()
  
for i in range(n-2):
  if s[i] == s[i + 2]:
    print(i + 1, i + 3)
    exit()
  
print(-1, -1)
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree < 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree < 0:
            max_i = i + 1
            break
    else:
        max_i = counter

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )
print(rep)
result = []
for i in range(N):
    if ree != 0:
        print(candidates[(-1 * rep[0] + i) % N])
    else:
        print(candidates[(-1 * rep[0] + i) % N])



### FIXED CODE ###


import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])
n=int(input())
d=[]
for i in range(3, n+1)
  if i%3==0 or "3" in str(i):
    d.append(i)
print(' ', end="")
print(*d)


### FIXED CODE ###

n=int(input())
d=[]
for i in range(1,n+1):
    if i%3==0 or "3" in str(i):
        d.append(i)
print(" ",end="")
print(*d)
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    elif m or f == -1:
        print('F')

    elif m + f >= 80:
        print('A')

    elif m + f >= 65 < 79:
        print('B')

    elif m + f >= 50 < 64:
        print('C')

    elif m + f >= 30 < 49:
        print('D')

    elif m + f >= 50 < 49:
        r >= 50:
        print('C')
    
    elif m + f < 30:
        print('F')

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')
        
    else:
        print('A')
# 2019-11-14 10:01:24(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

mod = 10 ** 9 + 7
def main():
    n, m, *broken_treads = [int(x) for x in sys.stdin.read().split()]
    safe = sorted((set(range(1, n+1)) - set(broken_treads)))

    p = [0] * (n + 1) # p[i] は連続するi段の、1~i段目までの登り方の総パターン
    p[1] = 1
    for i in range(2, n+1):
        p[i] = p[i-1] + p[i-2]

    count = 1 # 最初に0th stepを踏んでいるので1
    sections = []
    for i in range(1, n+1):
        if i in safe:
            count += 1
        else:
            if count >= 1:
                sections.append(p[count])
                count = 0
            else: # countが0だったら一つ前も壊れている
                print(0)
                sys.exit()
    
    if count >= 1:    # if the last is not broken.
        sections.append(p[count])

    ans = reduce(lambda x, y: x * y % mod, sections)
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

mod = 10 ** 9 + 7
n, m, *a = [int(x) for x in sys.stdin.read().split()]

safe = sorted(set(range(1,n+1)) - set(a))
dp = [0] * (n + 2)
dp[0] = 0
dp[1] = 1
for i in safe:
    dp[i+1] = (dp[i] + dp[i-1]) % mod

print(dp[-1])
S = input()
L = S.split()
a = L[0]
a = int(a)
b = L[1]
b = int(b)
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')

### FIXED CODE ###

S = input()
L = S.split()
a = L[0]
a = int(a)
b = L[1]
b = int(b)
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif a == b:
    print('a == b')
def splitintinput():
    return map(int,input().split())

H,N = splitintinput()
dp = [[0] * (H+1) for i in range(N)]
A,B = splitintinput()
for j in range(1, H+1):
    dp[0][j] = B * math.ceil(j/A)

for i in range(1,N):
    A,B = splitintinput()
    for j in range(1, A+1):
        dp[i][j] = min(dp[i-1][j], B)
    for j in range(A+1, H+1):
        dp[i][j] = min(dp[i-1][j], dp[ij-A] + B)

print(dp[N-1][H])

### FIXED CODE ###

H,N =map(int,input().split()) 
dp = [[0] * (10001) for i in range(1001)]
A,B = map(int,input().split()) 
for j in range(1, H+1):
    dp[0][j] = B * int((j+A-1)/A)

for i in range(1,N):
    A,B = map(int,input().split())
    for j in range(1, A+1):
        dp[i][j] = min(dp[i-1][j], B)
    for j in range(A+1, H+1):
        dp[i][j] = min(dp[i-1][j], dp[i][j-A] + B)

print(dp[N-1][H])
S = int(input())
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
  print('Bad')
else:
  print('Good')

### FIXED CODE ###

S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
  print('Bad')
else:
  print('Good')
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod
  
X, Y = map(int,input().split())

m = (2*Y - X) / 3
n = (2*X - Y) / 3

ans = 0

if m.is_integer() and n.is_integer():
    m = int(m)
    n = int(n)
    if m<n:m, n = n, m
        
print(comb(m+n, n, 10**9+7))


### FIXED CODE ###

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod
  
X, Y = map(int,input().split())

mm = (2*Y - X) / 3
nn = (2*X - Y) / 3

ans = 0

if mm.is_integer() and nn.is_integer():
    mm = int(mm)
    nn = int(nn)
    if mm >=0 and nn>=0:
        ans =comb(mm+nn, nn, 10**9+7)
      
print(ans)
import sys
input = sys.stdin.readline
N = int(input())
d = [0] + list(map(int, input().split()))
rres = 0
if N == 1:
  print(d[1])
  exit(0)
for t in range(13):
  res = True
  l = sorted(d)
  nl = sorted(d)
  for _ in range(N + 1):
    l.sort()
    for i in range(N):
      if abs(l[i] - l[i + 1]) < t:
        nl.append(24 - l[i + 1])
        nl.remove(l[i + 1])
    if abs(l[0] - l[-1]) < t:
      nl.append(24 - l[-1])
      nl.remove(l[-1])
    nl.sort()
    l = nl
  for i in range(N):
    if abs(nl[i] - nl[i + 1]) < t:
      res = False
  if abs(nl[-1] - nl[0]) < t:
    res = False
  if res:
    rres = t
    #print(nl)
  else:
    break
 #print(res, t)
print(rres)

### FIXED CODE ###

import sys
import heapq
input = sys.stdin.readline
N = int(input())
d = list(map(int, input().split()))
rres = 0
if N == 1:
  print(d[0])
  exit(0)
for t in range(13):
  res = True
  q = sorted(d)
  heapq.heapify(q)
  l = [0, 24]
  i = 0
  c = 0
  while len(q) and c < 2 * N ** 2:
    p = heapq.heappop(q)
    if abs(p - l[i]) < t:
      heapq.heappush(q, 24 - p)
    else:
      i += 1
      l.append(p)
      l.sort()
    c += 1
  if c >= 2 * N ** 2:
    res = False
  l.sort()
  for i in range(1, len(l)):
    if abs(l[i - 1] - l[i]) < t:
      res = False
      break
  #print(l)
  if res:
    rres = t
  else:
    break
 #print(res, t)
print(rres)
a, b, c = map(int, input().split())
d = a-b
if c <= d:
    print(0)
elif:
    print(c-d)


### FIXED CODE ###

a, b, c = map(int, input().split())
d = a-b
if c <= d:
    print(0)
else:
    print(c-d)
input = input()
print(input * input)

### FIXED CODE ###


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

# x, n = 10, 5
# p =  [4, 7, 10, 6, 5]
# ->9が解
# x, n = 6, 5
# p = [4, 7, 10, 6, 5]

# x, n = 1, 1
# # p = list(range(1, 101))
# p = [1]

# pに含まれない整数リストを、最小値-1最大値+1も含めて求める
pl = min(p)-1
pr = max(p)+2
npl = list(range(pl, pr))
np = list(set(npl) - set(p))
np.sort()

# np内で最もxに近い数値を算出する
mx = x
res = np[0]
for k in np:
  t = abs(k - x)
  if t < mx:
    mx = t
    res = k
 
print(res)

### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
  print(x)
  exit()
  
# x, n = 10, 5
# p =  [4, 7, 10, 6, 5]
# ->9が解
# x, n = 6, 5
# p = [4, 7, 10, 6, 5]

# x, n = 1, 1
# # p = list(range(1, 101))
# p = [1]

# pに含まれない整数リストを、最小値-1最大値+1も含めて求める
pl = min(p)-1
pr = max(p)+2
npl = list(range(pl, pr))
np = list(set(npl) - set(p))
if len(np) == 0:
  print(x)
  exit()
np.sort()

# np内で最もxに近い数値を算出する
mx = x
res = np[0]
for k in np:
  t = abs(k - x)
  if t < mx:
    mx = t
    res = k
 
print(res)
W,H,x,y,r = map(int, raw_input().split(' '))
print "Yes" if r <= x <= W-r and r <= y <= H-r else "No"

### FIXED CODE ###

W,H,x,y,r = map(int, input().split())
if r <= x <= W-r and r <= y <= H-r:
    print ('Yes')
else:
    print ('No')
# -*- coding: utf-8 -*-

a,b = map(int, raw_input().split())
h_max = 40
w_max = 100
ans = []
for j in range(w_max):
    buff = [ 0 for i in range(h_max/2)] + [ 1 for i in range(h_max/2)]
    ans.append(buff)

h = h_max
w = w_max
a = a - 1
b = b - 1

px = 0
py = 0
while b > 0:
    b = b - 1
    ans[px][py] = 1
    px = px + 2
    if px > w_max - 1:
        py = py + 2
        px = 0
#    print("[{} {}]".format(px, py))

px = 0
py = h_max / 2 + 1
while a > 0:
    a = a - 1
    ans[px][py] = 0
    px = px + 2
    if px > w_max - 1:
        py = py + 2
        px = 0
#    print("[{} {}]".format(px, py))

print("{} {}".format(h, w))
for j in range(h):
    s = ""
    for i in range(w):
        if ans[i][j] == 0:
            s = s + '.'
        else:
            s = s + '#'
    print s



### FIXED CODE ###

# -*- coding: utf-8 -*-

ans = 0
a = int(raw_input())
b = int(raw_input())
ans = ans + min([a,b])
a = int(raw_input())
b = int(raw_input())
ans = ans + min([a,b])

print ans
import sys
from collections import deque
import copy
import math
def main():
    N, K = map(int, input().split())
    a = [float(i) for i in input().split()]
    A = [0] * (N + 1)
    if K >= N:
        for i in range(1, N+1):
            if i > 1:
                print(' ', end='')
            print(N, end='')
        print()
        sys.exit()
    for i in range(1, N+1):
        if a[i - 1] > N:
            a[i - 1] = N
        A[i] = a[i - 1]
    for _ in range(K):
        count = [0] * (N + 1)
        for i in range(1, N+1):
            if A[i] == N:
                left_d = 1
                right_d = N
                count[1:] += 1
            else:
                left_d = math.ceil(i - A[i] - 0.5)
                right_d =  math.floor(i + A[i] + 0.5)
                if left_d < 1:
                    left_d = 1
                if right_d > N:
                    right_d = N
                for j in range(left_d, right_d+1):
                    count[j] += 1
        A = copy.copy(count)
        flag = True
        for i in range(1, N+1):
            if A[i] != N:
                flag = False
                break
        if flag:
            break
    for i in range(1, N+1):
        if i > 1:
            print(' ', end='')
        print(A[i], end='')
    print()


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
import copy
import math
def main():
    N, K = map(int, input().split())
    a = [int(i) for i in input().split()]
    A = [0] * (N + 1)
    if K >= 41:
        for i in range(1, N+1):
            if i > 1:
                print(' ', end='')
            print(N, end='')
        print()
        sys.exit()
    for i in range(1, N+1):
        A[i] = a[i - 1]
    for _ in range(K):
        count = [0] * (N + 1)
        for i in range(1, N+1):
            left_d = max(math.ceil(i - A[i]), 1)
            right_d = min(math.floor(i + A[i]), N)
            count[left_d] += 1
            if right_d + 1 <= N:
                count[right_d + 1] -= 1
        for i in range(1, N+1):
            count[i] += count[i - 1]
        A = copy.copy(count)
    
    for i in range(1, N+1):
        if i > 1:
            print(' ', end='')
        print(A[i], end='')
    print()


if __name__ == '__main__':
    main()