n =int(input())
a =list(map(int,input().split()))for i inrange(n):
left = i -1if i >0else-1
right = i +1if i < n-1else0print(a[left]+ a[right], end=" ")
n =int(input())
a =list(map(int,input().split()))# 当负数个数小于等于总数一半时,可以将 1 ~ i、1 ~ i - 1 翻转# 总次数为 2 * 负数个数,不超过 n# 当负数超过一半,先将所有数翻转,再按上述方法,# 总次数为 2 * 小于一半 + 1,不超过 nprint(sum(i if i >0else-i for i in a))
N =int(input())
A =sorted(list(map(int,input().split())))
B =sorted(list(map(int,input().split())))
pa =0; pb =0; ans =0while pa < N and pb < N:if2* A[pa]> B[pb]:
pa +=1; pb +=1
ans +=1else:
pa +=1print(ans)
from math import sqrt, log, floor
t =int(input())for _ inrange(t):
k, m =map(int,input().split())
left =1; right = m **2while left <= right:
mid =(left + right)//2
num = sqrt(mid)+ floor(log(mid, k))if num > m:
right = mid -1else:
left = mid +1print(left)
N =int(input())
A =sorted(list(map(int,input().split())))
B =sorted(list(map(int,input().split())))
pa =0; pb =0; ans =0while pa < N and pb < N:if2* A[pa]> B[pb]:
pa +=1; pb +=1
ans +=1else:
pa +=1print(ans)
from math import sqrt, log, floor
t =int(input())for _ inrange(t):
k, m =map(int,input().split())
left =1; right = m **2while left <= right:
mid =(left + right)//2
num = sqrt(mid)+ floor(log(mid, k))if num > m:
right = mid -1else:
left = mid +1print(left)