Harryxun/stf_run huggingface dataset:
H,W = map(int,input().split())
a,b = map(int,input().split())

white = (H * W) - (W * a) - ((H - a) * b)

print(white)

### FIXED CODE ###

A,B,C = map(int,input().split())

print(min(B//A,C))
D, N = map(int, input().split())

lst = []
X = 100 ** D

for i in range(1,101):
    if i % X == 0:
        pass
    else:
        lst.append(i*X)

print(lst[N-1])


### FIXED CODE ###

D, N = map(int, input().split())

lst = []
X = "00" * D

for i in range(1,102):
    if i % 100 == 0:
        pass
    else:
        lst.append(str(i) + X)

print(lst[N-1])
import numpy as np
N=int(input())
print(np.sum(np.array(np.arange(N))))

### FIXED CODE ###

N=int(input())
print(N*(N-1)//2)
S=input()
T=input()
ans=0
for i in range(3)
if S[i]==T[i]:
  ans+=1
print(ans)

### FIXED CODE ###

S=input()
T=input()
ans=0
for i in range(3):
    if S[i]==T[i]:
      ans+=1
print(ans)
N=int(input())
pages=N // 2
if N%2==0:
  else:
    pages=pages+1
print(pages)

### FIXED CODE ###

N=int(input())
pages=N // 2
if N % 2==0:
        pass
else:
    pages=pages+1
print(pages)
s1, s2, s3 = input().split())

print(str.upper(s1[0]+" "+s2[0]+" "+s3[0]))

### FIXED CODE ###

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

print(str.upper(s1[0]+s2[0]+s3[0]))
import numpy as np
N, K = map(int, input().split())
ps = list(map(int, input().split()))
Es = np.array([sum(range(1, ps[i]+1))/ps[i] for i in range(N)], dtype=np.float64)
maxs = []
for i in range(N):
  if i<K:
    continue
  else:
    maxs.append(sum(Es[i-K:i]))
print(max(maxs))

### FIXED CODE ###

N, K = map(int, input().split())
ps = list(map(int, input().split()))
Es = [(ps[i]+1)/2 for i in range(N)]
maxs = []
for i in range(1, N+1):
  if i<K:
    continue
  elif i==K:
    tmp = sum(Es[:i])
    maxs.append(tmp)
  else:
    tmp = tmp +Es[i-1]-Es[i-K-1]
    maxs.append(tmp)
print(max(maxs))
b = input()

if b==A:
  print('T')
elif b==T:
  print('A')
elif b==G:
  print('C')
else:
  print('G')

### FIXED CODE ###

b = input()

if b=='A':
  print('T')
elif b=='T':
  print('A')
elif b=='G':
  print('C')
else:
  print('G')
if abs(a-c) <= d:
    print('Yes')

elif abs(b - c) <= d and abs(a - b):
    print('Yes')

else:
    print('No')

### FIXED CODE ###

# abc097_a
# 絶対値abs

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

if abs(a-c) <= d:
    print('Yes')

elif abs(b - c) <= d and abs(a - b) <= d:
    print('Yes')

else:
    print('No')
S=input()
T=input()
ans=0
for x in range(3)
if S[i]==T[i]:
  ans+=1
print(ans)

### FIXED CODE ###

S=input()
T=input()
ans=0
for i in range(3):
    if S[i]==T[i]:
      ans+=1
print(ans)
N = int(input())
p = int([input() for i in range(N)])
max=100

for i in range(N):
    if p(i) > max:
        max=p(i)
        m=i

p(m) = p(m)/2

for i in range(N):
    A += p(i)

print(A)  

### FIXED CODE ###

N = int(input())
p = [int(input()) for i in range(N)]
A = 0
max=99

for i in range(N):
    if p[i] > max:
        max = p[i]
        m = i

p[m] = p[m]/2


for i in range(N):
    A += p[i]

print(int(A))
x = int(input())

ans = 0
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
        tmp = i ** j
        #tmp = pow(i, j)
        if tmp > x:
            tmp = i ** (j-1)
            #tmp = pow(i, j-1)
            #print(tmp, i, j)
            break
    ans = max(tmp, ans)

print(ans)

### FIXED CODE ###

x = int(input())

ans = 0
tmp = 1
for i in range(1, int(x**0.5)+1):
    for j in range(2, x):
      tmp = pow(i, j)
      if tmp > x:
          tmp = pow(i, j-1)
          #print(tmp, i, j)
          break

    ans = max(tmp, ans)

print(ans)
r,c = map(int,input().split(' '))
arr = [[0 for i in range(c+1)] for i in range(r+1)]

for i in range(r):
    row = list(map(int,input().split(' ')))
    for j in range(c):
        arr[i][j] = row[j]

for i in range(r):
    for j in range(c):
        arr[i][-1] += arr[i][j]
for i in range(c):
    for j in range(r):
        arr[-1][i] += arr[j][i]
for i in range(r+1):
    arr[-1][-1] += arr[-1][i]

for i in range(c):
    for j in range(r+1):
        print(arr[i][j],end = ' ')
    print(arr[i][-1])

### FIXED CODE ###

r,c = map(int,input().split(' '))
arr = [[0 for i in range(c+1)] for i in range(r+1)]

for i in range(r):
    row = list(map(int,input().split(' ')))
    for j in range(c):
        arr[i][j] = row[j]

for i in range(r):
    for j in range(c):
        arr[i][-1] += arr[i][j]
for i in range(c):
    for j in range(r):
        arr[-1][i] += arr[j][i]
        
if c == 1:
    for i in range(r):
        arr[-1][-1] += arr[i][0]
elif r == 1:
    for i in range(c):
        arr[-1][-1] += arr[0][i]
else:
    for i in range(r):
        arr[-1][-1] += arr[i][-1]
    
for i in range(r+1):
    for j in range(c):
        print(arr[i][j],end = ' ')
    print(arr[i][-1])
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

CNT = [0] * (10 ** 6)

ans = 0
for i in range(N):
    a = A[i]
    p = i - a

    if p > 0:
        ans += CNT[p]

    CNT[i + a] += 1

print(ans)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

CNT = [0] * (10 ** 7)

ans = 0
for i in range(N):
    a = A[i]
    p = i - a

    if 0 <= p <= (10 ** 7):
        ans += CNT[p]

    if 0 <= i + a <= (10 ** 7):
        CNT[i + a] += 1

print(ans)
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    diff_positive = dict()
    diff_negaitive = dict()
    pos_max = 0
    nega_max = 0
    a = [0 for _ in range(n)]
    b = [0 for _ in range(n)]

    for i in range(n):
        ai, bi = map(int, input().split())
        a[i] = ai
        b[i] = bi

        if ai - bi >= 0:
            diff_positive[i] = ai - bi
            pos_max = max(pos_max, ai - bi)
        else:
            diff_negaitive[i] = bi - ai
            nega_max = max(nega_max, abs(ai - bi))

    posi = sorted(diff_positive.items(), key=lambda x: x[1], reverse=True)
    nega = sorted(diff_negaitive.items(), key=lambda x: x[1], reverse=True)
    taka_point = 0
    aoki_point = 0

    if len(posi) % 2 == 0:
        taka = posi[::2] + nega[::2]
        aoki = posi[1::2] + nega[1::2]

        for t in taka:
            taka_point += a[t[0]]

        for a in aoki:
            aoki_point += b[a[0]]

        print(taka_point - aoki_point)
    else:
        taka = posi[::2] + nega[1::2]
        aoki = posi[1::2] + nega[::2]

        for t in taka:
            taka_point += a[t[0]]

        for a in aoki:
            aoki_point += b[a[0]]

        ans1 = taka_point - aoki_point

        taka = posi[1::2] + nega[::2]
        aoki = posi[::2] + nega[1::2]

        for t in taka:
            taka_point += a[t[0]]

        for a in aoki:
            aoki_point += b[a[0]]

        ans2 = taka_point - aoki_point
        print(max(ans1, ans2))


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    n = int(input())
    dishes = list()
    ans = 0

    # See:
    # https://poporix.hatenablog.com/entry/2019/01/28/222905
    # https://misteer.hatenablog.com/entry/NIKKEI2019qual?_ga=2.121425408.962332021.1548821392-1201012407.1527836447
    for i in range(n):
        ai, bi = map(int, input().split())
        dishes.append(tuple([ai + bi, ai, bi]))

    for index, dish in enumerate(sorted(dishes, reverse=True)):
        if index % 2 == 0:
            ans += dish[1]
        else:
            ans -= dish[2]

    print(ans)


if __name__ == '__main__':
    main()
import sys
import os

def file_input():
    f = open('ABC167/input.txt', 'r')
    sys.stdin = f

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

    d=1
    keys=list(range(N))
    li={s:-1 for s in keys}
    li[0]=0

    pre_d=0
    i=0
    while True:
        i+=1
        pre_d=d
        d=A[d-1]
        if li[d-1]!=-1:
            break
        li[d-1]=i

    # print(pre_d)
    # print(d)
    # roop=pre_d-d
    roop=i-li[d-1]
    print(A[(K-d)%roop+d])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

def file_input():
    f = open('ABC167/input.txt', 'r')
    sys.stdin = f

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

    d=1
    keys=list(range(N))
    li={s:-1 for s in keys}
    li[0]=0

    roop=0
    pre_d=0
    for i in range(1,K+1):
        pre_d=d
        d=A[d-1]
        # print("i:"+str(i)+" "+str(pre_d)+"->"+str(d))
        if li[d-1]!=-1:
            roop=i-li[d-1]
            # print("detect_roop:"+str(i)+"~"+str(li[d-1]))
            break
        else:
            li[d-1]=i

    if roop!=0:
        k=1
        for j in range((K-li[d-1]-1)%roop+li[d-1]+1):
            k=A[k-1]
        print(k)
    else:
        print(d)


if __name__ == '__main__':
    main()
a = int(''.join(list(map(int, input().split()))))
print('YES' if a % 4 == 0 else 'NO')

### FIXED CODE ###

a = int(input().rstrip().replace(' ', ''))
print('NO' if a%4 else 'YES')
N = int(input())
A = [int(input()) for i in range(N)]


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]

is_there_tow_maximum = A.count(maxiuam) >= 2
if is_there_tow_maximum:
    answer = (str(maxiuam) + "\n") * N
    print(answer)
    exit()

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = answer.append(second if Ai == maxiuam else maxiuam for Ai in A)
answer = "\n".join(map(str, answer))

print(answer)


### FIXED CODE ###

import collections


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


sorted_A = list(reversed(sorted(A)))

maxiuam = sorted_A[0]
is_there_tow_maximum = A.count(maxiuam) >= 2

second = None
for Ai in sorted_A:
    if Ai < maxiuam:
        second = Ai
        break

answer = []
for Ai in A:
    if is_there_tow_maximum:
        answer.append(maxiuam)
    elif Ai == maxiuam:
        answer.append(second)
    else:
        answer.append(maxiuam)
answer = "\n".join(map(str, answer))

print(answer)
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    float x1,x2,x3,y1,y2,y3,gx,gy,G,Xc,Yc,r;
    int n;
    scanf("%d", &n);
    for (int i=0;i<n;i++) {
        scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
        gx = (x1+x2+x3)/3;
        gy = (y1+y2+y3)/3;
        G =( y2*x1-y1*x2 +y3*x2-y2*x3 +y1*x3-y3*x1 );
        Xc = ((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*G);
        Yc =-((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*G);
        r = sqrt( (x1 - Xc) * (x1 - Xc) + (y1 - Yc) * (y1 - Yc) );
        printf("%.3f %.3f %.3f\n", Xc, Yc, r);
    }
    return EXIT_SUCCESS;
}


### FIXED CODE ###

n = int(input())
for _ in range(n):
    x1,y1,x2,y2,x3,y3 = map(float, input().split())
    gx = (x1+x2+x3)/3
    gy = (y1+y2+y3)/3
    G=( y2*x1-y1*x2 +y3*x2-y2*x3 +y1*x3-y3*x1 )
    Xc= ((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*G)
    Yc=-((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*G)
    r = ( (x1 - Xc) * (x1 - Xc) + (y1 - Yc) * (y1 - Yc) )**0.5
    print("%.3f %.3f %.3f"%(Xc,Yc,r))
import numpy as np

S = input()
s = len(S)
shift = 10**100
K = shift.bit_length()

ini_ad = np.array([1 if i == "R" else -1 for i in S])

def db(A:list, k:int):
    dv = np.array([[0]*s for _ in range(k+1)])
    dv[0] = A
    for kk in range(1,k+1):
        for n in range(s):
            dv[kk][n] = dv[kk-1][dv[kk-1][n]]
    return dv[k]

a = list(range(s))+ini_ad
for i in range(1,K):
    if (shift >> i)&1:
        a = db(a, i)
ans = [0]*s
for j in a:
    ans[j]+=1
print(*ans)

### FIXED CODE ###

LOG = 18

def main():
    S = input()
    N = len(S)
    to = []
    for _ in range(LOG):
        l = [0]*N
        to.append(l)
        
    for i in range(N):
        to[0][i] = i + 1 if S[i] == "R" else i -1
    
    for i in range(1, LOG):
        for j in range(N):
            to[i][j] = to[i-1][to[i-1][j]]
            
    ans = [0]*N
    for j in range(N):
        ans[to[LOG-1][j]] += 1
        
    print(*ans)
    return

main()
N,M = list(map(int, input().split()))
A = []
B = []

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0
for i in range(N):
	idx = num_list.index(min(A))
	sum += A[idx]*B[idx]
	A[idx] = 10000000
	ans += 1
	if(sum >= M):
		break

print(ans)


### FIXED CODE ###

import numpy as np

N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0

idx = np.argsort(A)

for i in range(N):
	if(sum+B[idx[i]] >= M):
		for j in range(B[idx[i]]):
			ans += A[idx[i]]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx[i]]*B[idx[i]]
	sum += B[idx[i]]
print(ans)
import math
import collections
import fractions
import itertools
import functools
import operator

def ncr(n, r):
    if n < r: return 0
    r = min(r, n-r)
    if r == 0:
        return 1
    numer = functools.reduce(operator.mul, range(n, n-r, -1), 1)
    denom = functools.reduce(operator.mul, range(1, r+1), 1)
    return numer / denom

def solve():
    n, k = map(int, input().split())
    for i in range(1,k+1):
        ans = (ncr(k-1, i-1) * ncr(n-k+1, i)) % (10**9+7)
        print(int(ans))
    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###

import math
import collections
import fractions
import itertools
import functools
import operator

def ncr(n, r):
    if n < r: return 0
    r = min(r, n-r)
    if r == 0:
        return 1
    numer = functools.reduce(operator.mul, range(n, n-r, -1), 1)
    denom = functools.reduce(operator.mul, range(1, r+1), 1)
    return numer // denom % (10 ** 9 + 7)

def solve():
    n, k = map(int, input().split())
    for i in range(1,k+1):
        ans = (ncr(k-1, i-1) * ncr(n-k+1, i)) % (10**9+7)
        print(int(ans))
    return 0

if __name__ == "__main__":
    solve()
a, b = map(int, input().split.())

if 13 <= a :
  print(b)
elif 6 <= a <= 12 :
  print(b/2)
else :
  print(0)

### FIXED CODE ###

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

if 13 <= a :
  print(b)
elif 6 <= a <= 12 :
  print(int(b/2))
else :
  print(0)
t=list(input())
if len(t)==1:
    if t[0]=="?":
        print("D")
    else:
        print(*t)
if t[0]=="?":
    if t[1]=="?":
        t[0]="P"
        t[1]="D"
    elif t[1]=="D":
        t[0]="P"
    else:
        t[0]="D"
for i in range(1,len(t)-1):
    if t[i]=="?":
        if t[i-1]=="P":
            t[i]="D"
        elif t[i-1]=="D":
            if t[i+1]=="P":
                t[i]="D"
            else:
                t[i]="P"
if t[-1]=="?":
    t[-1]="D"
print(*t,sep="")

### FIXED CODE ###

t=list(input())
if len(t)==1:
    if t[0]=="?":
        print("D")
    else:
        print(*t)
    exit()
if t[0]=="?":
    if t[1]=="?":
        t[0]="P"
        t[1]="D"
    elif t[1]=="D":
        t[0]="P"
    else:
        t[0]="D"
for i in range(1,len(t)-1):
    if t[i]=="?":
        if t[i-1]=="P":
            t[i]="D"
        elif t[i-1]=="D":
            if t[i+1]=="P":
                t[i]="D"
            else:
                t[i]="P"
if t[-1]=="?":
    t[-1]="D"
print(*t,sep="")
N = int(input())
S = input()
  
co = 0
index =0
n =[]
str = ""

for i in N:
  index=str.find(S[i])
  if index == -1 :
    str += S[i]
    n.append(2)
  else :
    n[i]++

co = 1
for i in n.size():
  co = co * n[i]
co--;

print(co % 1000000007)

### FIXED CODE ###

N = int(input())
S = input()
  
co = 0
index =0
n =[]
str = ""

for i in range(N):
  index=str.find(S[i])
  if index == -1 :
    str += S[i]
    n.append(2)
  else :
    n[index] += 1

co = 1
for i in range(len(n)):
  co = co * n[i]
co -= 1

print(co % 1000000007)
n, q = map(int, input().split())

#print(n,q)
edge = []
for i in range(n-1):
    a = list(map(int, input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int, input().split()))
    add_list.append(p)

#print(edge,add_list)


dir_edge = []
for i in range(n):
    dir_edge.append([])

for e in edge:
    dir_edge[e[0]-1].append(e[1]-1)
    dir_edge[e[1]-1].append(e[0]-1)
#print(dir_edge)


add_value = [0]*n
for v in add_list:
    add_value[v[0]-1] += v[1]
#print(add_value)


ans = [-1] *n
def dfs(index, parent,value):
    value += add_value[index]
    ans[index] = value
    for i in dir_edge[index]:
        if (parent == i):
            continue
        dfs(i,index,value)
        

dfs(0, -1, 0)
print(*ans)

### FIXED CODE ###

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

#print(n,q)
edge=[]
for i in range(n-1):
    a = list(map(int,input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int,input().split()))
    add_list.append(p)

#print(edge,add_list)

ans = [0] * n
edge_list = [-1] * n

for e in edge:
    edge_list[e[1]-1] = e[0]-1

add_value = [0]*n
for v in add_list:
    add_value[v[0]-1] += v[1]

#print(edge_list)
#print(add_value)


dp = [-1] * n
def get_value(i):
    if(dp[i]!=-1):
        return dp[i]
    tmp = add_value[i]
    if edge_list[i] != -1:
        tmp += get_value(edge_list[i])
    dp[i] = tmp
    return dp[i]

for i in range(n):
    ans[i] = get_value(i)
    #print(i,ans)

print(' '.join(map(str,ans)))
import math
N= int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
prod = math.prod(A)

count = 0

for i in range(N):
    qualify = 1

    if i > 1 and A[i - 1] == A[i]:
        continue

    if prod/A[i] % A[i] != 0:
        continue

    for j in range(i+1, N):
        if (A[i] % A[j]) == 0:
            qualify = 0
            break


    count += qualify


print(count)




### FIXED CODE ###

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

not_p = set(range(102)) - set(P)

min_value = 200
min_list = []

for v in not_p:
    dist = abs(X-v)

    if dist < min_value:
        min_value = dist
        min_list = [v]

    if dist == min_value:
        min_list.append(v)

print(min(min_list))
import sys
input = sys.stdin.readline
N,A,B=list(map(int,input(),split())
print(sum(i for i in range(N)) if A <= sum(map(int,str(i))) <= B))           

### FIXED CODE ###

N,A,B =map(int,input().split())
print(sum(i for i in range(N+1) if A <= sum(map(int,str(i))) <= B))
a, b, c = map(int, input().split())
print((a - b) % c)

### FIXED CODE ###

a, b, c = [int(input()) for x in range(3)]
print((a - b) % c)
s = input().split(" ");
n = s[0];
a = s[1];
b = s[2];
if a > b :
  print(0);
else
  if n = 1 or n = 2:
    print(1);
  else
    ans = (b - a)*(n - 2)+1;
    print(ans);

### FIXED CODE ###

s = input().split(" ");
n = int(s[0]);
a = int(s[1]);
b = int(s[2]);
if a > b :
  print(0);
else :
  if n == 1 :
    if a==b :
      print(1);
    else :
      print(0);
  else :
    ans = (b - a)*(n - 2)+1;
    print(ans);
import numpy as np
import heapq


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


def lii():
    return list(map(int, input().split(' ')))


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


def main():
    s = input()
    K = ii()

    sub = []
    for i in range(len(s)):
        sub.append(s[i:])

    heapq.heapify(sub)
    minsub = heapq.heappop(sub)

    if len(minsub) >= K:
        print(minsub[:K])
        return

    cand = []
    for i in range(1, len(minsub)+1):
        cand.append(minsub[:i])
    K -= len(minsub)
    assert K > 0

    min2sub = heapq.heappop(sub)
    for i in range(1, len(min2sub)+1):
        if not min2sub[:i] in cand:
            cand.append(min2sub[:i])
            K -= 1
            if K == 0:
                print(min2sub[:i])
                return

    min3sub = heapq.heappop(sub)
    for i in range(1, len(min3sub)+1):
        if not min3sub[:i] in cand:
            cand.append(min3sub[:i])
            K -= 1
            if K == 0:
                print(min3sub[:i])
                return

    print(minsub, min2sub, min3sub)

    raise ValueError


if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
import heapq


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


def lii():
    return list(map(int, input().split(' ')))


def lvi(N):
    l = []
    for _ in range(N):
        l.append(ii())
    return l


def lv(N):
    l = []
    for _ in range(N):
        l.append(input())
    return l


def main():
    s = input()
    K = ii()

    sub = []
    for i in range(len(s)):
        sub.append(s[i:])

    heapq.heapify(sub)
    minsub = heapq.heappop(sub)

    if len(minsub) >= K:
        print(minsub[:K])
        return

    cand = []
    for i in range(1, len(minsub)+1):
        cand.append(minsub[:i])
    K -= len(minsub)
    assert K > 0

    while K > 0:
        minsub_ = heapq.heappop(sub)
        for i in range(1, len(minsub_)+1):
            if not minsub_[:i] in cand:
                cand.append(minsub_[:i])
                K -= 1
                if K == 0:
                    print(minsub_[:i])
                    return

if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N):
    A_n[i] = abs(A[i] - A[i - 1])
A_n[0] = abs(A[0] - 0)
A_n[N] = abs(A[N - 1] - 0)

A_total = sum(A_n)
A_added = [0] + A + [0]
for i in range(1, N + 1):
    if A_added[i + 1] >= A_added[i] and A_added[i] >= A_added[i - 1]:
        print(A_total)
    elif A_added[i + 1] >= A_added[i - 1] and A_added[i - 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i] >= A_added[i + 1] and A_added[i + 1] >= A_added[i - 1]:
        print(A_total - 2 * abs(A_added[i + 1] - A_added[i]))
    elif A_added[i] >= A_added[i - 1] and A_added[i - 1] >= A_added[i + 1]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i - 1] >= A_added[i] and A_added[i] >= A_added[i + 1]:
        print(A_total)
    elif A_added[i - 1] >= A_added[i + 1] and A_added[i + 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i + 1]))

### FIXED CODE ###

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

A_n = [0] * (N + 1)
for i in range(1, N):
    A_n[i] = abs(A[i] - A[i - 1])
A_n[0] = abs(A[0] - 0)
A_n[N] = abs(A[N - 1] - 0)

A_total = sum(A_n)
A_added = [0] + A + [0]
for i in range(1, N + 1):
    if A_added[i + 1] >= A_added[i] and A_added[i] >= A_added[i - 1]:
        print(A_total)
    elif A_added[i + 1] >= A_added[i - 1] and A_added[i - 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i] >= A_added[i + 1] and A_added[i + 1] >= A_added[i - 1]:
        print(A_total - 2 * abs(A_added[i + 1] - A_added[i]))
    elif A_added[i] >= A_added[i - 1] and A_added[i - 1] >= A_added[i + 1]:
        print(A_total - 2 * abs(A_added[i] - A_added[i - 1]))
    elif A_added[i - 1] >= A_added[i] and A_added[i] >= A_added[i + 1]:
        print(A_total)
    elif A_added[i - 1] >= A_added[i + 1] and A_added[i + 1] >= A_added[i]:
        print(A_total - 2 * abs(A_added[i] - A_added[i + 1]))
    else:
        print(0)