peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import numpy as np

n = int(input())
a = list(map(int, input().split()))
a = np.array(a)
a -= np.array(range(1,n+1))

b = round(np.mean(a))

ans = int(np.sum(abs(a-b)))

print(ans)
# Judge status: Wrong Answer
X=int(input())
N=1
while N*(N+1)//2<X:
    N+=1

while (N*(N+1)//2-X)%2==1:
    N+=1
print(N)
# Judge status: Accepted
from collections import defaultdict
n=int(input())
d=list(map(int,input().split()))
mod=998244353
if d[0]!=0:
      print(0)
      exit()
dd=defaultdict(lambda:0)
for di in d:
      dd[di]+=1
if dd[0]>1:
      print(0)
      exit()
ans=1
for i in set(dd.keys()):
      if i==0:
            continue
      ans*=(dd[i-1]**dd[i])%mod
print(ans%mod)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
q, r = divmod(n, 2)
print(a[0] + sum(a[1:q]) * 2 + a[q] * r)
# Judge status: Accepted
A,B = map(int,input().split())

if A == B:
  print(0)
  exit(0)

C = 0
# 符号が同じ
if A * B > 0:
  if A < B:
    C = abs(B - A)
  else:
    C = abs(B - A) + 2
# 符号が違う
elif A * B < 0:
  C = abs(abs(B) - abs(A)) + 1
# どちらかが0
else:
  if A == 0:
    C = abs(B)
    if B < 0:
      C += 1
  elif B == 0:
    C = abs(A)
    if 0 < A:
      C += 1
  
  
  
print(C)
# Judge status: Accepted
N = int(input())
k = [[0] * 10 for _ in range(10)]

for n in range(1, N+1):
  sn = str(n)
  k[int(sn[0])][int(sn[-1])] += 1

ans = 0
for i in range(1, 10):
  for j in range(1, 10):
    ans += (k[i][j] * k[j][i])
    
print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())
for i in range(K):
  if A >= B:
    B *= 2
  elif B >= C:
    C *= 2
  #print(i, A, B, C)
if A < B and B < C:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
D, N = map(int, input().split())

d = 100 ** D * N

if d % 100 ** D == 0:
    d += 1

print(d)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

B = [0 for i in range(N)]

for i in range(N-1, -1, -1):
  count = 0
  for j in range(i, N, i+1):
    count += B[j]
    if count%2 == A[i]:
      B[i] = 0
    else:
      B[i] = 1

sum = sum(B)
if sum == 0:
  print(0)
else:
  print(sum)
  ans = []
  for i in range(N):
    if B[i] == 1:
      ans.append(i+1)
  print(*ans)
# Judge status: Wrong Answer
a = list(map(int,input().split()))
print(sum(a)-min(a))
# Judge status: Accepted
A,B,C,K = map(int, input().split())
if A+B<K<=A+B+C:
  ans = A-(K-B-A)
elif A<K<=A+B:
  ans = A
else:
  ans = K
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
count = 0

if N % 2 ==0:
    for i in range((N+2)//2 - 1):
        if A[2*i ] % 2 == 1:
            count += 1
else:
    for i in range((N+2)//2):
        if A[2*i ] % 2 == 1:
            count += 1

print(count)
# Judge status: Accepted
n, a, b = map(int, input().split())
M = 10**9 + 7
total = pow(2, n, M)

def comb(n, k, p):
    if k > n-k:
        return comb(n, n-k, p)
    num, den = 1, 1
    for i in range(k):
        num = num * (n-i) % p
        den = den * (i+1) % p
    return num * pow(den, p-2, p) % p

print((total - 1 - comb(n,a,M) - comb(n,b,M)) % M)
# Judge status: Wrong Answer
from math import log2, floor
X, Y = map(int, input().split())
ans = floor(log2(Y//X)) + 1
print(ans)
# Judge status: Accepted
X = int(input())
x = 1
while ((x-1)**4)*5 < X:
    x += 1
for i in range(x):
    for j in range(-x, i):
        if i**5-j**5 == X:
            a = [i,j]
            break 
print(*a)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(sum(a[n::2]))
# Judge status: Accepted
N, x = map(int, input().split())
As = list(map(int, input().split()))
As.append(0)

f = sum(As)
  
for i in range(0,N):
  if As[i]+As[i+1] > x:
    if As[i] <= x:
      As[i+1] = x - As[i]
    else:
      As[i+1] = 0
      As[i] = x

s = sum(As)

print(f-s)
# Judge status: Accepted
n = int(input())
d1,d2 = [],[]
for _ in range(n):
    a,b = map(int,input().split())
    d1.append(a)
    d2.append(b)
check = True
for i in range(2,n):
    if d1[i-2] == d2[i-2] and d1[i-1] == d2[i-1] and d1[i] == d2[i]:
        print("Yes")
        check = False
        break
if check:
    print("No")
# Judge status: Accepted
def main():
    S=input()
    s=0
    for i in range(0,len(S)):
        s=s+int(S[i])
    t=len(S)-s
    print(2*min(s,t))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int, input().split())

s1 = "a" *b
s2 = "b" *a
if s1 < s2:
    print(s1)
else:
    print(s2)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

a.sort(reverse=True)

import heapq
heap=[a[0]*(-1)]

ans=0

for aa in a[1:]:
    tmp=heapq.heappop(heap)
    ans+=((-1)*tmp)
    heapq.heappush(heap,-1*aa)
    heapq.heappush(heap,-1*aa)

print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())

d = {}
for _ in range(N):
    A,B = map(int,input().split())
    d[A] = B

res = 0
cnt = 0
for i in sorted(d):
    if(d[i] <= M):
        res += d[i]*i
        M -= d[i]
    else:
        res += M * i
        break

print(res)
# Judge status: Wrong Answer
K,A,B = map(int,input().split())

if B-A < 3:
  print(1+K)
  exit()

ans = 1
ans += (K//(A+2))*B

if K%(A+2) == A+1:
  ans += B
else:
  ans += K%(A+2)
  

print(ans)
# Judge status: Accepted
d=int(input())
s="Christmas"
for i in range(25,d,-1):
    s=s+" Eve"
print(s)
# Judge status: Accepted
s, t = map(str, input().split())
print(t + s)
# Judge status: Accepted
s=str(input())
n=len(s)

for i in range(0,n):
 if s[i]!=s[-i-1]:
    print("No")
    exit()

new_n1=int((n-1)/2)
new_s1=s[:new_n1]

new_n2=int((n+3)/2)
new_s2=s[new_n2-1:]
for i in range(0,len(new_s1)):
 if new_s1[i]!=new_s1[-i-1]:
    print("No")
    exit()
else:
  pass
for i in range(0,len(new_s2)):
 if new_s2[i]!=new_s2[-i-1]:
    print("No")
    exit()
else:
  print("Yes")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
c = 0
m = n + 1
for i in p:
  if i == min(m, i):
    c += 1
print(c)
# Judge status: Accepted
N = int(input())
ans = ""
while(N > 0):
    N -= 1
    ch = N % 26
    ans = chr(97 + ch) + ans
    N //= 26
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())

A = []
B = []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
C = []
D = []
for i in range(m):
    a, b = map(int, input().split())
    C.append(a)
    D.append(b)

for i in range(n):
    t = 0
    T = []
    for j in range(m):
        t = abs(A[i] - C[j]) + abs(B[i] - D[j])
        T.append(t)
    print(T.index(min(T)) + 1)
# Judge status: Accepted
N = int(input())
print("ABC" if N < 1000 else "ABD")
# Judge status: Accepted
import math
n = int(input())
a_li = [int(w) for w in input().split()]

ans = 10**9
for a in a_li:
    # t = 0
    # while a % 2 == 0:
    #     a //= 2
    #     t += 1

    t = math.log2(a & -a)
    ans = min(ans, t)

print(int(ans))
# Judge status: Accepted
from collections import defaultdict

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

d = defaultdict(int)
for a in a_list:
    d[a] += 1

ans = 0
for i, c in d.items():
    ans += c - i if c >= i else c
print(ans)
# Judge status: Accepted
a = input()
b = input()
mini = len(b)
if a == b:
  print(0)
  exit(0)
for s in range(len(a) - len(b) + 1):
  c = 0
  for i, j in zip(a[s:s + len(b)], b):
    if i != j:
      c += 1
  mini = min([mini, c])
print(mini)
# Judge status: Accepted
from math import ceil #小数点以下切り上げ
 
a, b = map(int, input().split())
print(ceil((a+b)/2))
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))

dp = [0,abs(li[1]-li[0])]

for i in range(2,n):
    dp += [min(dp[-2]+abs(li[i]-li[i-2]),dp[-1]+abs(li[i]-li[i-1]))]

print(dp[-1])
# Judge status: Accepted
n = int(input())
s = sorted([list(input()) for _ in range(n)], key=len)

ans = []
for i in s[0]:
  t = float("inf")
  for j in s:
    t = min(t, j.count(i))
  ans.append(i*t)
ans = sorted(list(set(ans)))
print("".join(ans))
# Judge status: Accepted

N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 1
total = 0
for i in range(N):
  total += L[i]
  if total <= X:
    cnt += 1
  else:
    break
print(cnt)
# Judge status: Accepted
s = input()
st = 'abcdefghijklmnopqrstuvwxyz'
print(st[st.index(s)+1])
# Judge status: Accepted
n = int(input())
ans = ['a']

for i in range(n-1):
    buf = []
    for j in ans:
        l = len(set(j))
        for c in range(l+1):
            buf.append(j+chr(ord('a')+c))
    ans = buf

for i in ans:
    print(i)
# Judge status: Accepted
s = input()
n = len(s)

ans = 0


for bit in range(1 << (n-1)):
    f = s[0]
    for i in range(n - 1):
        if bit & (1 << i):
            f += "+"
        else:
            f += "-"
        f += s[i+1]
    if  eval(f) == 7:
        print(f+"=7")
        break
# Judge status: Accepted
import math
import fractions
import sys
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))



def funct(n):
	i=1
	res=0
	while True:
		ans=2*5**i
		
		if n//ans==0:
			break
		res+=(n//ans)
		i+=1
	return res


N=input1()
a=0
if N%2==1:
	a=0
else:
	a=funct(N)

print(a)
# Judge status: Accepted
n = int(input())
v = list(map(int, input().split()))
v.sort()
ave = v[0]
for i in range(1, n):
    ave = (ave + v[i]) / 2
print(ave)
# Judge status: Accepted
s = input()
s_1 = s.replace('eraser', '').replace('erase', '').replace('dreamer','').replace('dream','')
if s_1 == '':
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a, b, k = map(int, input().split())
change_a = max(0, a - k)
if a < k:
    b = max(0, b - (k - a))
print(change_a, b)
# Judge status: Accepted
import collections
n = int(raw_input())
elems = map(int, raw_input().split(' '))



m,c = +float('inf'),0 
for e in elems:
	if e <= m: c +=1
	m = min(e, m) #elems[j])
print c
# Judge status: Accepted
A,B,K = map(int,input().split())
if B - A >= 2 * K :
  for i in range(K):
    print(A + i)
  for j in reversed(range(K)):
    print(B - j)
else:
  for _ in range(A,B + 1):
    print(_)
# Judge status: Wrong Answer
l=list(int(input()) for _ in range(5))
s=list(10-i%10 for i in l)
s.remove(max(s))
print(sum(l)+sum(s))
# Judge status: Wrong Answer
N, M = map(int, input().split())
sc = [list(map(int, input().split()))for i in range(M)]
ans="-1"
tmp=0
for i in range(0,1000):
	s = str('{:0=3}'.format(i))
	for j in range(M):
		if sc[j][0]==1 and sc[j][1] == 0:
			print(-1)
			exit()
		if s[len(s)-N+sc[j][0]-1]!=str(sc[j][1]):
			break
	else:
		if s[0]=="0":
			s=str(int(s)+100)
		ans=s
		break
print(ans)
# Judge status: Accepted
n = int(input())
*A, = map(int, input().split())
maxA = max(A)
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
D = {a: 0 for a in A}
for a in A:
    if C[a] > 1:
        D[a] = 1
    for b in range(2 * a, maxA + 1, a):
        D[b] = 1
print(sum([D[a] == 0 for a in A]))
# Judge status: Wrong Answer
s=input()
if s=="AAA" or s=="BBB":
  print("NO")
else:
  print("YES")
# Judge status: Accepted
n, m, x, y = map(int, input().split())

xl = list(map(int, input().split()))
yl = list(map(int, input().split()))

for z in range(x + 1, y + 1):
  if max(xl) < z and min(yl) >= z:
    print("No War")
    break
else:
  print("War")
# Judge status: Accepted
A = sorted(list(map(int,input().split())))
N = int(input())
A[-1] = A[-1]*2**N
print(sum(A))
# Judge status: Accepted
o = input()
e = input()

for i in range(len(e)):
    print(o[i] + e[i], end='')

if len(e) != len(o):
    print(o[-1], end='')
print()
# Judge status: Wrong Answer
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26

for d in range(1,D+1):
    choice=0
    cost=c[0]*(d-last[0])
    for i in range(1,26):
        if c[i]*(d-last[i])>cost:
            choice=i
            cost=c[i]*(d-last[i])
    last[choice]=d
    print(choice)
# Judge status: Accepted
letters="abcdefghijklmnopqrstuvwxyz"
ans=sorted(set(letters)^set(input()))
print("None" if len(ans)==0 else ans[0])
# Judge status: Accepted
def solve(n, m, LR):
    maxl = 0
    minr = n
    for l, r in LR:
        if maxl < l:
            maxl = l
        if minr > r:
            minr = r
    return minr - maxl + 1 if maxl <= minr else 0

_n, _m = map(int, input().split())
_LR = [list(map(int, input().split())) for _ in range(_m)]
print(solve(_n, _m, _LR))
# Judge status: Accepted
n,k=map(int,input().split())
P=list(map(int,input().split()))
now=sum(P[:k])
m=now
for i in range(n-k):
    now+=P[k+i]
    now-=P[i]
    m=max(m,now)
E=(m+k)/2
print(E)
# Judge status: Accepted
n = int(input())
d = {"AC":0, "WA":0, "TLE":0, "RE":0}
for _ in range(n):
    s = input()
    d[s] += 1

for s in ['AC', 'WA', 'TLE', 'RE']:
    print("{} x {}".format(s, d[s]))
# Judge status: Accepted
a,b,c = (map(int, input().split()))
s1 = a+b
s2 = b+c
s3 = c+a
if s1==c or s2==a or s3==b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
L=list(map(int, input().split()))
L.sort(reverse=True)
maxL=L.pop(0)
if maxL< sum(L):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# agc014_a.py]
A, B, C = map(int,input().split())
cnt = 0
inf = 10**6
for i in range(inf):
    if A%2==0 and B%2==0 and C%2==0: 
        a = (B+C)//2
        b = (A+C)//2
        c = (B+A)//2
        A = a
        B = b
        C = c
        cnt += 1
    else:
        break
if cnt == inf:
    cnt = -1
print(cnt)
# Judge status: Wrong Answer
s = input()
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']

print(l[l.index(s) + 1])
# Judge status: Wrong Answer
import numpy as np
K, N = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
ma = 0
for i in range(N-1):
  tmp = abs(A[i] -A[i+1])
  if min(tmp,K - tmp) > ma:
    ma = min(tmp,K-tmp)
print(K - ma)
# Judge status: Accepted
from collections import defaultdict

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

for i in range(1,N):
    for j in range(i+1, N+1):
        if j<=X or i>=Y:
            path = j-i
        else:
            path = min(j-i, abs(X-i)+abs(j-Y)+1)
        cnt_dict[path] += 1

for i in range(1,N):
    print(cnt_dict[i])
# Judge status: Accepted
N = int(input())
a = map(int, input().split())

other = mult_2 = mult_4 = 0
for t in a:
    if t % 4 == 0:
        mult_4 += 1
    elif t % 2 == 0:
        mult_2 += 1
    else:
        other += 1

if other - 1 + (1 if mult_2 > 0 else 0) <= mult_4:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int("".join(map(str,input().split())))
print(("NO","YES")[N % 4 == 0])
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
m=max(a)
i=a.index(m)

for j in range(n):
    if j!=i:
       print(m)
    else:
        del a[i]
        print(max(a))
# Judge status: Wrong Answer
n =int(input())
if n>=30:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import string

n = int(input())
alpha = string.ascii_lowercase
x = [[] for _ in range(26)]

for _ in range(n):
    s = input()
    for a in alpha:
        x[alpha.index(a)].append(s.count(a))

ans = ""
for i in range(26):
    ans += min(x[i]) * alpha[i]

print(ans)
# Judge status: Accepted
def gcd(a, b):
    if a == 0: return b
    if b == 0: return a
    if a == b: return a
    if a > b: return gcd(b, a%b)
    return gcd(a, b%a)
def lcm(a, b):
    if a == b == 0:
        return 0
    return abs(a*b)/gcd(a, b)
a, b = map(int, input().split())
print(int(lcm(a, b)))
# Judge status: Wrong Answer
import numpy as np
N=int(input())
A=list(map(int, input().split()))
mean=0
for i in range(N):
  A[i]-=(i+1)
  mean+=A[i]
  mean/=(i+1)
A=np.array(A)

#平均を０に近づけるようにする
mean=round(mean)
def sudness(A):
  sad=0
  for a in A:
    sad+=abs(a)
  return sad

print(sudness(A-mean))
# Judge status: Wrong Answer
a = list(map(int,input().split()))
if a[0]-a[2]>=0:
    a[0]=a[0]-a[2]
    a.pop()
    print(a)
else:
    a[1]=a[1]+a[0]-a[2]
    a[0]=0
    a.pop()
    print(a)
# Judge status: Accepted
W, a, b = map(int, input().split())
A = [a, a + W]
B = [b, b + W]
if A[1] < B[0]:
    print(B[0] - A[1])
elif B[1] < A[0]:
    print(A[0] - B[1])
else:
    print(0)
# Judge status: Accepted
import sys
n,c,k,*t = map(int, sys.stdin.read().split())
t.sort()

i=0
cnt=0
while i<n:
  departure=t[i]+k
  p=0
  for j in range(i,n):
    if t[j] > departure or p==c:
      break
    p+=1
  i+=p
  cnt+=1
print(cnt)
# Judge status: Accepted
n_s = input()
n_s = n_s[::-1]
#n = int(n_s)

pay = 0
back = 0
flag = 0

dp = [[0,0] for _ in range(len(n_s) + 1)]

dp[0][0] = int(n_s[0])
dp[0][1] = 10 - int(n_s[0])

for i in range(len(n_s)):
  i += 1
  if i == len(n_s):
    n = 0
  else:
    n = int(n_s[i])
  
  dp[i][0] = min(dp[i-1][0] + n, dp[i-1][1] + n+1)
  dp[i][1] = min(dp[i-1][0] + (10-n), dp[i-1][1] + (10-n-1))

print(min(dp[-1]))
# Judge status: Accepted
def main():
  num = int(input())
  string = input()
  if len(string)<=num:
    print(string)
  else:
    print(string[0:num]+'...')

main()
# Judge status: Accepted
import math
n=int(input())
print(pow(2,math.floor(math.log2(n))))
# Judge status: Accepted
n,m =map(int,input().split())

H=[]
H=list(map(int,input().split()))
C=[]
for i in range(n):
    C.append(1)

for i in range(m):
    a,b = map(int,input().split())
    if H[a-1]==H[b-1] :
        C[a-1] = 0
        C[b-1] = 0
    elif H[a-1]<H[b-1] :
        C[a-1] = 0
    else:
        C[b-1] = 0

print( C.count(1))
# Judge status: Accepted
x, y = map(int, input().split())

count = 0
while x <= y:
    count += 1
    x *= 2
print(count)
# Judge status: Accepted
a, b, k = map(int, input().split())
n = []
for i in range(1, min(a, b) + 1):
  if a % i == 0 and b % i == 0:
    n.append(i)
print(n[::-1][k-1])
# Judge status: Accepted
s = list(input())
t = list(input())
s.sort()
t.sort()
t.reverse()
if s < t:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
x = int(input())
count = 0
for i in range(1,x):
  for j in range(1,x):
    a = str(i)
    b = str(j)
    if((a[0]==b[-1]) and (a[-1]==b[0])): count +=1
print(count)
# Judge status: Accepted
from bisect import bisect_right
n=int(input())
a=[int(input()) for _ in range(n)]
a=a[::-1]
lis=[a[0]]
for i in range(1,n):
  if lis[-1]<=a[i]:
    lis.append(a[i])
  else:
    inde=bisect_right(lis,a[i])
    lis[inde]=a[i]
print(len(lis))
# Judge status: Accepted
if __name__ == '__main__':
    A =[]
    B = input()
    A = B.split()

    a = int(A[0])
    b = int(A[1])
    c = int(A[2])
    k = int(A[3])

    if a > k:
        print(k)
    elif (a+b) > k:
        print(a)
    else:
        ans = 2*a-k+b
        print(ans)
# Judge status: Accepted
def main():
    length = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    count_operation = 0
    for i in range(length):
        if a[i] < b[i]:
            count_operation -= (b[i] - a[i]) // 2
        else:
            count_operation += a[i] - b[i]
    print("Yes" if count_operation <= 0 else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, a: "List[int]"):
    a.sort(reverse=True)
    print(sum(a[::2]) - sum(a[1::2]))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, L = map(int,input().split())
A = []
for i in range(N):
    x = L + i
    A.append(x)

y = sum(A)
B = sorted(A)

if L <= 0 and L + N - 1 >= 0:
    print(y)
elif L >= 0:
    y -= B[0]
    print(y)
elif L + N - 1 < 0:
    y -= B[N - 1]
    print(y)
# Judge status: Accepted
def main():
    x = int(input())
    cnt = x // 100
    m, M = cnt * 100, cnt * 105
    if m <= x <= M:
        print(1)
    else:
        print(0)

if __name__ == "__main__":
    main()
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K%2 == 0:
    print(A-B)
else:
    print(B-A)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
d = list(map(int, input().split()))
cnt = defaultdict(int)
if d[0] != 0:
    print(0)
else:
    ans = 1
    for i in range(n):
        cnt[d[i]] += 1
    for i in range(1, n):
        ans = (ans * cnt[d[i] - 1] % 998244353)

    print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
if A < C < B or A > C > B :
    print("Yes")
else :
    print("No")
# Judge status: Wrong Answer
#abc056 b 
w,a,b=map(int,input().split())
if b<a+w or b+w>a:
    print(0)
else:
    print(min(abs(b+w-a),abs(a+w-b)))
# Judge status: Accepted
a, b, k = map(int, input().split())
n = []
for i in range(1, 101):
    if a%i==0 and b%i==0:
        n.append(i)
print(n[-k])
# Judge status: Accepted
sd = input()
t = input()
sn = len(sd)
tn = len(t)
s = []
for i in range(sn-tn, -1, -1):
    t_kamo = sd[i: i+tn]
    for j in range(tn+ 1):
        if j == tn:
            print((sd[:i] + t + sd[i+tn:]).replace("?", "a"))
            exit()
        elif t_kamo[j] == "?":
            continue
        elif t_kamo[j] != t[j]:
            break
print("UNRESTORABLE")
# Judge status: Accepted
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  h=list(str(i))
  tmp=0
  for j in h:
    tmp+=int(j)
  if a<=tmp<=b:
    ans+=i
print(ans)
# Judge status: Wrong Answer
N = int(input())
sum = 0


for A in range(1,N):
  if N // A > 1:
    for B in range(1, N // A):
      sum += 1
  else:
    for B in range(1, N // A + 1):
      sum += 1

print(sum)
# Judge status: Accepted
n=int(input())
s = [input() for _ in range(n)] 
myset=set([])

for i in s:
    myset.add(i)

print(len(myset))
# Judge status: Accepted
N,M = map(int,input().split())
a = [1]*N
for i in range(M):
    a[int(input())-1] = 0

mod = int(1e9+7)

dp = [0]*N

if N == 1:
    print(1)
    exit()

if a[0] and a[1]:
    dp[0] = 1
    dp[1] = 2
elif not a[0] and a[1]:
    dp[1] = 1

for i in range(2,N):
    if a[i]:
        dp[i] = dp[i-1] + dp[i-2]
    else:
        dp[i] = 0

print(dp[N-1]%mod)
# Judge status: Accepted
n = int(input())
s = input()
ans = 0
for i in range(1,len(s)):
    s1 = set(s[:i])
    s2 = set(s[i:])
    ans = max(ans, len(s1&s2))
print(ans)
# Judge status: Wrong Answer
tenki = input()

if tenki == "RRR":
    print(3)
elif tenki == "RRS" or tenki[1:3] == "SRR":
    print(2)
elif tenki == "RSS" or tenki == "SRS" or tenki == "SSR":
    print(1)
else:
    print(0)
# Judge status: Accepted
A=[int(x) for x in input().split()]
if A[0]+A[1]+A[2]>21:
   print("bust")
else:
    print("win")
# Judge status: Wrong Answer
n = int(input())
h = [int(i) for i in input().split()]
ans = []
tmp = 0

for i in range(1,len(h)):
    if h[i-1] - h[i] >= 0:
        tmp += 1
    else:
        ans.append(tmp)
        tmp = 0

print(tmp)
# Judge status: Wrong Answer
a, b, x = [int(i) for i in input().split()]

print("YES" if a+b >= x else "NO")
# Judge status: Wrong Answer
N = int(input())
l = list(map(int, input().split()))

new_l = sorted(l)
ans = 99999

for i in range(N):
    f = sum(new_l[:i])
    s = sum(new_l[i:])
    if abs(f-s)<=ans:
        ans = abs(f-s)

print(ans)
# Judge status: Accepted
from collections import deque
X = input()
L = deque([])
for e in X:
    if e == "T" and len(L) > 0 and L[-1] == "S":
        L.pop()
    else:
        L.append(e)

print(len(L))
# Judge status: Accepted
a, b = map(int,input().split())
c = (a + b) // 2
if (a + b) / 2 == c:
    c = c
else:
    c = c + 1
print(c)
# Judge status: Wrong Answer
n,m = map(int,input().split())
pyl = [list(map(int,input().split())) for nesya in range(m)]
predic = dict()
pyl = sorted(pyl,key = lambda x:x[1])
for py in pyl:
  p = py[0]
  if p in predic:
    predic[p] += 1
  else:
    predic[p] = 1
  print((str(p).zfill(6))+(str(predic[p]).zfill(6)))
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
a = collections.Counter(A)
ans = [0, 0]
for i in a.keys():
    if a[i] >= 2:
        ans.append(i)
    if a[i] >= 4:
        ans.append(i)
ans.sort()
print(ans[-1]*ans[-2])
# Judge status: Accepted
s = str(input())
ans = int(s[0])+int(s[1])+int(s[2])
print(ans)