Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

mod=10**9+7
k=int(input())
s=input()
n=len(s)
c=1
t=1
ans=0
for i in range(k+1):
  ans+=c*t
  ans%=mod
  c*=(n+k-i)*pow(i+1,mod-2,mod)
  c%=mod
  t*=25
  t%=mod
print(ans)


### FIXED CODE ###

mod=10**9+7
f=[1]
for i in range(2*10**6+7):f+=[f[-1]*(i+1)%mod]
def comb(a,b):return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod
k=int(input())
s=input()
n=len(s)
ans=0
for i in range(k,-1,-1):
  ans+=comb(n+k,i)*pow(25,i,mod)
  ans%=mod
print(ans%mod)
### BUGGY CODE ###

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

max_ans = M // N
if M % 2 == 1:
    x = 2
else:
    x = 1

for a in reversed(range(1, max_ans + 1, x)):
    mod = M % a
    if mod == 0:
        print(a)
        exit()

### FIXED CODE ###

from itertools import product

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

max_ans = M // N

ans = 1
tmp = 2
tmpM = M
max_prime = int(M ** 0.5)
all_list = []
i = -1
k = 0
div = 2
while tmpM != 1:
    if tmpM % div == 0:
        tmpM = tmpM // div
        if k == 0:
            i += 1
            all_list.append(set())
            all_list[i].add(div ** k)
            k += 1
        all_list[i].add(div ** k)
        k += 1

    else:
        k = 0
        if div == 2:
            div = 3
        elif div > max_prime:
            div = tmpM
        else:
            div += 2

if all_list == []:
    print(1)
    exit()

# print(all_list)
ans = 1

for div_tuple in product(*all_list):
    tmp = 1
    for k in div_tuple:
        tmp *= k
        if tmp > max_ans:
            break
    else:
        ans = max(ans, tmp)

print(ans)
### BUGGY CODE ###

# 入力
N, K = map(int, input().split())
H = [int(i) for i in input().split()]

# DPテーブルを用意
dp = [float("inf") for i in range(N)]
# 初期値をセット
dp[0] = 0

# 足場0から順次最小コストを決定する
for i in range(N):
    for j in range(1, K+1):
        if i + j < N:
            dp[i+j] = min(dp[i+j], (dp[i] + abs(H[i] - H[i+j])))

# 足場NのインデックスはN-1
print(dp[N-1])

### FIXED CODE ###

import numpy as np

# 入力
N, K = map(int, input().split())
H = np.array([int(i) for i in input().split()])

# ndarray型のDPテーブルを生成
dp = np.zeros(N, dtype=int)
# 初期値をセット
dp[0] = 0

# 各足場へたどり着く最小コストを調べる
for i in range(1, N):
    s = max(0, i-K)
    dp[i] = min(dp[s:i] + np.abs(H[i] - H[s:i])) # iより前の足場のコストに足す

print(dp[N-1])
### BUGGY CODE ###

def bfs(linkL, chckL, presN):
    nextNL = linkL[presN]
    breath = 1
    while(len(nextNL)!=0):
        for item in nextNL:
            chckL[item] = breath

        tmpNextNL = []
        for nextItem in nextNL:
            for chckItem in linkL[nextItem]:
                if chckL[chckItem] == -1:
                    tmpNextNL.append(chckItem)
                    chckL[chckItem] = -2
        
        breath += 1
        nextNL = tmpNextNL
    
    return chckL


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

lList = []

for indx in range(N):
    tmpList = []
    if indx != 0:   tmpList.append(indx-1)
    if indx != N-1: tmpList.append(indx+1)
    if indx == X-1: tmpList.append(Y-1)
    if indx == Y-1: tmpList.append(X-1)
    lList.append(tmpList)

mySum = [0] * (N-1)

for baseIndx in range(N):
    chckList = [-1] * N

    chckList[baseIndx] = 0

    chckList = bfs(lList, chckList, baseIndx)
    chckList = chckList[baseIndx+1:N]

    for sumIndx in range(N-1):
        mySum[sumIndx] += chckList.count(sumIndx+1)

for printIndx in range(N-1):
    print(mySum[printIndx])

### FIXED CODE ###

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

X = X-1
Y = Y-1

kDict = {}

for kIndx in range(1, N+1):
    kDict[kIndx] = 0

for jIndx in range(N):
    for iIndx in range(jIndx):
        if (jIndx <= X) or (iIndx >= Y):
            kDict[jIndx - iIndx] += 1
        elif (iIndx <= X) and (jIndx >= Y):
            kDict[(jIndx - iIndx) - (Y - X - 1)] += 1
        elif (iIndx <= X) and ((jIndx > X) and (jIndx < Y)):
            if 2 * jIndx - (X + Y) - 1 > 0:
                kDict[(jIndx - iIndx) - (2 * jIndx - (X + Y) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        elif ((iIndx > X) and (iIndx < Y)) and (jIndx >= Y):
            if (X + Y) - 2 * iIndx - 1 > 0:
                kDict[(jIndx - iIndx) - ((X + Y) - 2 * iIndx - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        else:
            if (2 * (jIndx - iIndx) - (Y - X) - 1) > 0:
                kDict[(jIndx - iIndx) - (2 * (jIndx - iIndx) - (Y - X) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1

for kIndx in range(1, N):
    print(kDict[kIndx])
### BUGGY CODE ###

import sys
# inputを高速化する。
input = sys.stdin.readline

# 入力
N, W = map(int, input().split())

dp = [[0 for i in range(W+1)] for j in range(N+1)]


def chmax(a, b):
    if a >= b:
        return a
    else:
        return b

def knapsack(n, w):
    lst_weight = [0 for _ in range(N)]
    lst_value = [0 for _ in range(N)]
    for i in range(N):
        lst_weight[i], lst_value[i] = map(int, input().split())


    for i in range(N):
        for sum_w in range(W+1):
            # i番目の品物を選ぶ
            if sum_w - lst_weight[i] >= 0:
                dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w - lst_weight[i]] + lst_value[i])
            # i番目の品物を選ばない
            dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w])
    
    return dp[n][w]


print(knapsack(N, W))

### FIXED CODE ###


import sys

input = sys.stdin.readline

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

dp = [0] * (W + 1)
def knapsack(n, w):
    for _ in range(N):
        w, v = map(int, input().split())
        for wk in range(W, w-1, -1):
            tv = dp[wk - w] + v
            if tv > dp[wk]:
                dp[wk] = tv
    return dp[-1]

print(knapsack(N, W))
### BUGGY CODE ###

import numpy as np
N,X,Y = map(int, input().split())
cnt = np.zeros(N+1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if abs(X-i)+abs(j-Y)+1 < j-i:
            cnt[abs(X-i)+abs(j-Y)+1] += 1
        else:
            cnt[j-i] += 1
for i in range(1,N):
    print(int(cnt[i]))

### FIXED CODE ###

n,x,y=map(int,input().split())
ans=[0]*n
for i in range(1,n+1):
 for j in range(i+1,n+1):
   dist1=j-i
   dist2=abs(x-i)+abs(y-j)+1
   dist3=abs(y-i)+abs(x-j)+1
   d=min(dist1,dist2,dist3)
   ans[d]+=1
for i in range(1,n):
 print(ans[i])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
# print(N,A,sep="\n")
data = set(A)

def culc(data):
  A_min=min(data)
  if len(set(map(lambda x: x%A_min,data)))==1:
    return A_min
  for i in range(A_min,1,-1):
    if len(set(map(lambda x: x%i,data)))==1:
      return i
  return 1


print(culc(data))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
# print(N,A,sep="\n")
data = set(A)

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

def culc(data):
  A_min=min(data)
  if set(map(lambda x: x%A_min,data))=={0}:
    return A_min
  A.sort()
  ans = A_min
  for i in A[1:]:
    ans=gdc(ans,i)
    if set(map(lambda x: x%ans,data))=={0}:
      return ans
  return ans

print(culc(data))
### BUGGY CODE ###

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

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a


ans=0
for i in range(N):
	temp=0
	for idx, a in enumerate(A):
		if idx==i:
			continue
		temp=gcd(temp, a)
	ans=max(ans,temp)
print(ans)

### FIXED CODE ###

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

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

gcd_from_left = [0]*N # 自分のindexは含まないようなもの
gcd_from_right = [0]*N
 
for i in range(1,N):
  gcd_from_left[i] = gcd(A[i-1],gcd_from_left[i-1])
  gcd_from_right[N-1-i] = gcd(A[N-i],gcd_from_right[N-i])
  
ans = 0
 
for a,b in zip(gcd_from_left, gcd_from_right):
  x = gcd(a,b)
  if ans < x:
    ans = x
    
print(ans)
### BUGGY CODE ###

mod=10**9+7
n=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
Tres=[0]*n
Ares=[0]*n
Tres[0]=[0,T[0]]
Ares[-1]=[0,A[-1]]
for i in range(1,n):
  if T[i]!=T[i-1]:
    Tres[i]=[0,T[i]]
  else:
    Tres[i]=[1,T[i]]
  if A[-i-1]!=A[-i]:
    Ares[-i-1]=[0,A[-i-1]]
  else:
    Ares[-i-1]=[1,A[-i-1]]
ans=1
for i in range(n):
  ta,tb=Tres[i]
  aa,ab=Ares[i]  
  if ta==aa==1:
    ans*=min(tb,ab)%mod
  elif ta==0 and aa==1 and tb>ab:
    ans=0
  elif ta==1 and aa==0 and tb<ab:
    ans=0
  elif ta==0 and aa==0 and tb!=ab:
    ans=0
print(ans%mod)

### FIXED CODE ###

mod=10**9+7
n=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
Tres=[0]*n
Ares=[0]*n
Tres[0]=(0,T[0])
Ares[n-1]=(0,A[n-1])
for i in range(1,n):
  if T[i]>Tres[i-1][1]:
    Tres[i]=(0,T[i])
  else:
    Tres[i]=(1,T[i])
  if A[n-i-1]>Ares[n-i][1]:
    Ares[n-i-1]=(0,A[n-i-1])
  else:
    Ares[n-i-1]=(1,A[n-i-1])
if Tres[0]<=Ares[0]:
  ans=1
else:
  ans=0
for i in range(1,n):
  ta,tb=Tres[i]
  aa,ab=Ares[i]  
  if ta==aa==1:
    ans=ans*min(tb,ab)%mod
  elif ta==0 and aa==1 and tb>ab:
    ans=0
  elif ta==1 and aa==0 and tb<ab:
    ans=0
  elif ta==0 and aa==0 and tb!=ab:
    ans=0
print(ans%mod)
### BUGGY CODE ###

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

for i in range(N):
    print(A.count(i+1))

### FIXED CODE ###

N = int(input())

A = [int(i) for i in input().split()]

S = [0] * (N+1)

for i in A:
    S[i] += 1 

for s in S[1:]:
    print(s)
### BUGGY CODE ###

X = int(input())
a = [[]]
a[0].append(0)
n=0
flag = False
while(True):
    n+=1
    a.append([])
    for p in a[n-1]:
        a[n].append(p)
        a[n].append(p-n)
        a[n].append(p+n)
        if p==X or p-n==X or p+n==X:
            print(n)
            flag = True
            break
    if flag:
        break


### FIXED CODE ###

X = int(input())
j=0
for i in range(X*2):
    if (i*(i+1))//2<=X<=((i+1)*(i+2))//2:
        j=i
        break
print(j+1)
### BUGGY CODE ###

def solve(n, ga, sa, ba, gb, sb, bb):
    gd, sd, bd = gb - ga, sb - sa, bb - ba

    if bd <= 0:
        if sd <= 0:
            if gd <= 0:
                return n
            return n + n // ga * gd
        if gd <= 0:
            return n + n // sa * sd
        return max(n + g * gd + (n - g * ga) // sa * sd for g in range(n // ga + 1))
    if sd <= 0:
        if gd <= 0:
            return n + n // ba * bd
        return max(n + g * gd + (n - g * ga) // ba * bd for g in range(n // ga + 1))
    if gd <= 0:
        return max(n + s * sd + (n - s * sa) // ba * bd for s in range(n // sa + 1))
    (_, ga, gd), (_, sa, sd), (_, ba, bd) = \
        sorted([(gb / ga, -ga, gd), (sb / sa, -sa, sd), (bb / ba, -ba, bd)], reverse=True)
    ga, sa, ba = -ga, -sa, -ba
    return max(n + g * gd + s * sd + (n - g * ga - s * sa) // ba * bd
               for g in range(int(n // ga / 2.75), n // ga + 1)
               for s in range((n - g * ga) // sa + 1))


n = int(input())
ga, sa, ba = list(map(int, input().split()))
gb, sb, bb = list(map(int, input().split()))
n2 = solve(n, ga, sa, ba, gb, sb, bb)
n3 = solve(n2, gb, sb, bb, ga, sa, ba)
print(n3)


### FIXED CODE ###

def solve(n, ga, sa, ba, gb, sb, bb):
    ans = n
    for g in range(1 if ga >= gb else n // ga + 1):
        n2 = n - g * ga
        tmp1 = g * gb
        if ba >= bb:
            s = n2 // sa
            ans = max(ans, n2 + tmp1, n2 - s * sa + tmp1 + s * sb)
        elif sa >= sb:
            b = n2 // ba
            ans = max(ans, n2 + tmp1, n2 - b * ba + tmp1 + b * bb)
        else:
            for s in range(n2 // sa + 1):
                b = (n2 - s * sa) // ba
                ans = max(ans, n2 - s * sa - b * ba + tmp1 + s * sb + b * bb)
    return ans


n = int(input())
ga, sa, ba = list(map(int, input().split()))
gb, sb, bb = list(map(int, input().split()))
n2 = solve(n, ga, sa, ba, gb, sb, bb)
n3 = solve(n2, gb, sb, bb, ga, sa, ba)
print(n3)
### BUGGY CODE ###

H, W = map(int, input().split())
Map = []
for _ in range(H):
  List = list(input())
  Map.append(List)
points = [[0]*W for i in range(H)]
directions = [(1,0),(-1,0),(0,1),(0,-1)]
def countpoints(Map,i,j):
  ans = 1
  for direction in directions:
    p= i
    q = j
    while (0 <= p <= H-1) and (0 <= q <= W -1):
      p,q = p+direction[0],q+direction[1]
      if (p < 0 or H -1 < p) or (q < 0 or W-1 <q):
        break
      if Map[p][q] != '#':
        ans += 1
      else:
        break
  return ans
for i in range(H):
  for j in range(W):
    if Map[i][j] != '#':
      points[i][j] = countpoints(Map,i,j)
import numpy as np
results = np.array(points)
idx = np.unravel_index(np.argmax(results), results.shape)
print(results[idx])

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
Map=[list(input()) for h in range(H)]
Map=[[1 if s=='.' else 0 for s in Map[h]] for h in range(H)]
Map=np.array(Map,dtype=int)
L=Map.copy()
R=Map.copy()
U=Map.copy()
D=Map.copy()
for w in range(1,W):
    L[:,w]=(L[:,w-1]+1)*Map[:,w]
    R[:,-(1+w)]=(R[:,-w]+1)*Map[:,-(1+w)]
for h in range(1,H):
    U[h,:]=(U[h-1,:]+1)*Map[h,:]
    D[-(1+h),:]=(D[-h,:]+1)*Map[-(1+h),:]
print((L+R+U+D).max()-3)
### BUGGY CODE ###

LIMIT = 1000000000000000000

N = int(input())
A = map(int, input().split())
answer = 1

for e in A:
    answer *= e

if answer > LIMIT:
    print(-1)
else:
    print(answer)



### FIXED CODE ###

LIMIT = 1000000000000000000

def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    answer = 1

    for i in range(N):
        answer *= a[i]
        if answer > LIMIT:
            if 0 in a[i:]:
                print(0)
                return
            else:
                print(-1)
            return

    print(answer)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

flg = True
if n % 2 == 0:
    flg = False

b = []

for x in a:
    if flg:
        b.insert(0, str(x))
    else:
        b.append(str(x))

    flg = not flg

print(' '.join(b))

### FIXED CODE ###

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

x = a[::2]
y = a[1::2]

if n%2==0:
    res = y[::-1] + x
else:
    res = x[::-1] + y

res = list(map(str, res))
print(' '.join(res))
### BUGGY CODE ###

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

lower_a = list(map(lambda x: x - 1, a))
upper_a = list(map(lambda x: x + 1, a))
set_a = set(a + lower_a + upper_a)

temp_max = 0
for x in set_a:
    temp_max = max(temp_max, a.count(x) + lower_a.count(x) + upper_a.count(x))
print(temp_max)

### FIXED CODE ###

import collections

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

lower_a = list(map(lambda x: x - 1, a))
upper_a = list(map(lambda x: x + 1, a))
extended_a = collections.Counter(a + lower_a + upper_a)

print(extended_a.most_common()[0][1])
### BUGGY CODE ###

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

for _ in range(Q):
  B, C = map(int, input().split())
  count = A.count(B)
  if count >0:
    for _ in range(count):
      A.remove(B)
    A.extend([C]*count)
  print(sum(A))
  #print(A)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
cnt = [0]*(10**5+1)

s = sum(A)
for i in A:
  cnt[i] += 1

for _ in range(Q):
  B, C = map(int, input().split())
  s += (C-B)*cnt[B]
  print(s)
  cnt[C] += cnt[B]
  cnt[B] = 0
### BUGGY CODE ###


from functools import *
import sys
sys.setrecursionlimit(100000)

def acinput():
    return list(map(int, input().split(" ")))


N=input()
a=acinput()

if min(a)==0:
    print(0)
    sys.exit()
res=1

for sa in a:
    res*=sa
    if res>10**18:
        res=-1
        
    
print(res)


### FIXED CODE ###


from functools import *
import sys
sys.setrecursionlimit(100000)

def acinput():
    return list(map(int, input().split(" ")))


N=input()
a=acinput()

if min(a)==0:
    print(0)
    sys.exit()
res=1

for sa in a:
    res*=sa
    if res>10**18:
        res=-1
        break
        
    
print(res)
### BUGGY CODE ###

"""
D - Lazy Faith
"""


def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        left_t = max([t for t in ti if t <= x])
        right_t = min([t for t in ti if t >= x])
        left_s = max([s for s in si if s <= x])
        right_s = min([s for s in si if s >= x])
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t)))


if __name__ == '__main__':
    solve()


### FIXED CODE ###

"""
D - Lazy Faith
"""
# 解説を参考に作成（bisect）
import bisect


def solve():
    # データ読込
    A, B, Q = map(int, input().split())
    si = [-float('inf')] + [int(input()) for i in range(A)] + [float('inf')]
    ti = [-float('inf')] + [int(input()) for i in range(B)] + [float('inf')]
    xi = [int(input()) for i in range(Q)]
    # 問題計算
    for x in xi:
        txi = bisect.bisect_left(ti, x)
        left_t = ti[txi - 1]
        right_t = ti[txi]
        sxi = bisect.bisect_left(si, x)
        left_s = si[sxi - 1]
        right_s = si[sxi]
        print(min(abs(x - min(left_t, left_s)),
                  abs(x - max(right_t, right_s)),
                  abs(x - right_t) + abs(right_t - left_s),
                  abs(x - left_t) + abs(left_t - right_s),
                  abs(x - right_s) + abs(right_s - left_t),
                  abs(x - left_s) + abs(left_s - right_t)))


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

# https://atcoder.jp/contests/abc063/tasks/arc075_b
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, a, b = map(int, input().split())
    heap = []
    for _ in range(n):
        heappush(heap, -int(input()))

    ans = 0
    while True:
        strong_monster = heappop(heap)
        if strong_monster >= 0:
            break
        strong_monster += a
        for i in range(len(heap)):
            heap[i] += b
        heappush(heap, strong_monster)
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/abc063/tasks/arc075_b
import sys
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math
sys.setrecursionlimit(12345678)


def can_delete(ml, t, a, b):
    for i in range(len(ml)):
        ml[i] -= (b * t)

    count = 0
    for m in ml:
        if m > 0:
            count += math.ceil(m/(a-b))

    return t >= count


def main():
    n, a, b = map(int, input().split())
    monsters = []
    for _ in range(n):
        monsters.append(int(input()))

    l = 0
    r = 10**9
    while l < r:
        m = (l + r) // 2
        if can_delete(monsters.copy(), m, a, b):
            r = m
        else:
            l = m + 1

    print(r)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
s = []
c = []
s_dash = []
ans = 0

for i in range(n):
	s.append(input())
	c.clear()
	for j in s[i]:
		c.append(j)

	c.sort()
	c_str = ''
	for j in range(10):
		c_str += c[j]

	s_dash.append(c_str)
	s_dash.sort()

for i in range(n):
	for j in range(i+1,n):
		if s_dash[i][0] != s_dash[j][0]:
			break
		elif s_dash[i] == s_dash[j]:
			ans += 1

print(ans)


### FIXED CODE ###

def cmb(n, r):
	if n < r: return 0
	if r == 0: return 1
	if r == 1: return n
	if n - r < r: r = n - r

	numerator = [n - r + k + 1 for k in range(r)]
	denominator = [k + 1 for k in range(r)]

	for p in range(2,r+1):
		pivot = denominator[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p-1,r,p):
				numerator[k - offset] /= pivot
				denominator[k] /= pivot

	result = 1
	for k in range(r):
		if numerator[k] > 1:
			result *= int(numerator[k])

	return result

n = int(input())
s = []
for _ in range(n):
	tmp = list(input())
	tmp.sort()
	s.append(tmp)

s.sort()

count = 1
ans = 0
for i in range(n-1):
	if s[i] == s[i+1]:
		count += 1
	else:
		ans += cmb(count,2)
		count = 1

if count != 1:
	ans += cmb(count,2)

print(ans)
### BUGGY CODE ###

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

count = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1

print(count)

### FIXED CODE ###

k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s - (x + y) <= k:
            count += 1
print(count)
### BUGGY CODE ###

from fractions import gcd

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

ans = 0
for i in range(n):
    temp = None
    for j in range(n):
        if j == i:
            continue
        
        if temp is None:
            temp = a_list[j]
        else:
            temp = gcd(temp, a_list[j])
        
        if temp == 1:
            break
    
    if temp > ans:
        ans = temp
print(ans)

### FIXED CODE ###

from fractions import gcd

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

l_list = [0] * n
temp = a_list[0]
for i in range(n - 1):
    if temp == 1:
        l_list[i] = 1
        continue
    temp = gcd(temp, a_list[i])
    l_list[i] = temp

r_list = [0] * n
temp = a_list[n - 1]
for i in range(n - 1, 0, -1):
    if temp == 1:
        r_list[i] = 1
        continue
    temp = gcd(temp, a_list[i])
    r_list[i] = temp

ans = 0
for i in range(n):
    if i == 0:
        temp = r_list[1]
    elif i == n - 1:
        temp = l_list[n - 2]
    else:
        temp = gcd(l_list[i - 1], r_list[i + 1])
    if temp > ans:
        ans = temp
print(ans)
### BUGGY CODE ###

#%%
h, w, d = map(int, input().split())
a = [0] * h
for i in range(h):
    a[i] = list(map(int, input().split()))
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

pos = [[0] for _ in range(h*w+1)]
for i in range(h):
    for j in range(w):
        pos[a[i][j]] = [i+1, j+1]
#print(pos)

cost = [[0]*(h*w+1) for i in range(h*w+1)]
#print(cost)

for i in range(1, len(cost)):
    for j in range(i, len(cost)):
        pos1 = pos[i]
        pos2 = pos[j]
        dist = abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1])
        cost[i][j] = dist

##print(np.array(cost))


for i in range(q):
    tmp = 0
    while l[i] != r[i]:
        tmp += cost[l[i]][l[i]+d]
        l[i] += d
    print(tmp)


### FIXED CODE ###

#%%
h, w, d = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

reach = [0] * (w * h)
for i in range(h):
    for j in range(w):
        reach[a[i][j] - 1] = [i, j]
#print(reach)

count = [0] * (w * h)
for i in range((w * h)):
    if i - d < 0 : 
        pass
    else:
        count[i] = count[i - d] + (abs(reach[i][0] - reach[i - d][0]) + abs(reach[i][1] - reach[i - d][1]))
#print(count)

for i in range(q):
    print(count[r[i] - 1] - count[l[i] - 1])
### BUGGY CODE ###

K = int(input())

def calculate(k):

    res = 1

    n = 7

    if k % 2 == 0:
        print(-1)
        return

    if k % 5 == -1:
        print(-1)
        return

    while n % k > 0:
        n = (n % k) * 10 + 7
        res += 1

    print(res)

calculate(K)

### FIXED CODE ###

K = int(input())

def calculate(k):

    if k % 2 == 0:
        print(-1)
        return

    if k % 5 == 0:
        print(-1)
        return

    res = 1

    m = (((10 ** res) - 1) // 9) * 7


    while m % k > 0:
        res += 1
        m = m % k
        m = m * 10 + 7

    print(res)


calculate(K)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    ans,x=0,0
    for j in range(n):
        if j==i: continue
        ans+=abs(x-a[j])
        x=a[j]
    print(ans+abs(x))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
x,m=0,0
for i in range(n):
    m+=abs(x-a[i])
    x=a[i]
m+=abs(x)
for i in range(n):
    ans=m
    if i==0: ans+=abs(a[i+1])-abs(a[i+1]-a[i])-abs(a[i])
    elif i==n-1:
        ans+=abs(a[i-1])-abs(a[i])-abs(a[i]-a[i-1])
    else:
        ans+=abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i]-a[i+1])
    print(ans)