peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
k,x=map(int,input().split())
if x<=500*k:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
for i in range(N):
    if i % 2 ==0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)
# Judge status: Accepted
N = input()
if '9' in N:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
mod = 10**9 + 7
def cmb(n,r,mod):
	a=1
	b=1
	r = min(r,n-r)
	for i in range(r):
		a = a*(n-i)%mod
		b = b*(i+1)%mod
	return a*pow(b,mod-2,mod)%mod

n,a,b = map(int,input().split())
count = 0
all = pow(2,n,mod) - 1
nCa = cmb(n,a,mod)
nCb = cmb(n,b,mod)
ans = all - (nCa + nCb)
while (ans < 0):
  ans += mod
print(ans)
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
dv = V - W
dist = abs(B - A)
if dv*T >= dist:
        print("YES")
else:
    print("NO")
# Judge status: Accepted
s = input()

ans = True if s[0] == 'A' else False
num = 0
for i in range(1, len(s)):
    if s[i] == 'C' and i != len(s) - 1 and i != 1:
        num += 1
    elif ord(s[i]) <= ord('Z') and ord(s[i]) >= ord('A'):
        ans = False
        break

if num != 1:
    ans = False

print('AC' if ans else 'WA')
# Judge status: Wrong Answer
count1 = 0
count2 = 0
N, A, B = map(int, input().split())
S = list(input())
for i in S:
  if i == "a" and A + B >= count1:
    print("Yes")
    count1 += 1
  elif i == "b" and A + B >= count1 and B > count2:
    print("Yes")
    count1 += 1
    count2 += 1
  else :
    print("No")
# Judge status: Wrong Answer
import math
n = int(input())
arr = list(map(int,input().split()))
add = sum(arr)
x = math.ceil(add/n)
ans = 0
for i in range(len(arr)):
	ans += ((x-arr[i])*(x-arr[i]))
print(ans)
# Judge status: Accepted
s_list = list(input())
seizon_t = 0
s_amari = 0
for char in s_list:
  if char == "T":
    if s_amari == 0:
      seizon_t += 1
    else:
      s_amari -= 1
  else:
    s_amari += 1
print(2*seizon_t)
# Judge status: Accepted
N = int(input())

print((N+1)//2)
# Judge status: Accepted
n=int(input())
def f(s):
  return len(set([s[i] for i in range(len(s))]))
alphabet = [chr(i) for i in range(97, 97+26)]
for i in range(1,n+1):
  if i==1:
    iso=["a"]
  else:
    iso_new=[]
    for s in iso:
      for j in range(f(s)+1):
        iso_new.append(s+alphabet[j])
    iso = list(set(iso_new))

iso.sort()
for s in iso:
  print(s)
# Judge status: Accepted
def main():
    S = str(input())
    t = 0
    diff = 0
    near = 10000
    for i in range(2, len(S)):
        t = int(S[i-2]) * 100 + int(S[i-1]) * 10 + int(S[i])
        if 753 < t:
            diff = t - 753
        else:
            diff = 753 - t
        if near > diff:
            near = diff
    print(near) 
main()
# Judge status: Accepted
T=input().replace("?","D")
print(T)
# Judge status: Accepted
import math
x = input().split()
n = int(x[0])
a = int(x[1])
b = int(x[2])
z = 0
z = math.floor(n / (a+b)) * a
amari = math.floor(n % (a+b))
if amari == 0:
  pass
elif amari <= a:
  z += amari
else:
  z += a
print(z)
# Judge status: Wrong Answer
RS = input()
answer = 0

for i, j in enumerate(RS):
  if j == "R":
    answer += 1
  elif (i == 2 and j == "S") or (i == 1 and j == "S"):
    continue
  else:
    answer = 0
print(answer)
# Judge status: Wrong Answer
from collections import deque
d=deque()
s=input()
d.append(s)
Q=int(input())
for i in range(Q):
    r=input()
    if len(r.split()) == 3:
        T,F,C=r.split()
    else:
        T='1'
    if T == '1':
        s=d.pop()
        d.rotate(1)
        d.append(s)
        continue
    if T == '2':
        if F == '1':
            d.appendleft(C)
        if F == '2':
            d.append(C)

print("".join(d))
# Judge status: Accepted
O = input()
E = input()
x = len(E)
ans = ""
for i in range(len(O)-1):
    ans += O[i]
    ans += E[i]

ans += O[len(O)-1]
try:
    ans += E[len(O)-1]
except IndexError:
    pass
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
x=list(map(int,input().split()))
minus=[]
plus=[]
for i in range(N):
    if x[i]<0:
        minus.append(abs(x[i]))
    else:
        plus.append(x[i])
minus.append(0)
plus.append(0)

plus.sort()
minus.sort()


ans=int(1e9)
for i in range(K+1):
    if 0<=i<len(plus) and 0<=K-i<len(minus):
        ans=min(ans,plus[i]+minus[K-i]+min(plus[i],minus[K-i]))
print(ans)
# Judge status: Accepted
C = input()
alpha = [chr(ord('a') + i) for i in range(26)]
N = alpha.index(C)
print(alpha[N+1])
# Judge status: Accepted
def main():
    A, B = map(int, input().split())
    x = int(A/0.08)
    y = int((A+1)/0.08)
    for i in range(x, y+1):
        if int(i*0.08) == A and int(i*0.1) == B:
            print(i)
            return
    print(-1)

main()
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

from collections import Counter

c = Counter(a)

ma1 = 0
ma2 = 0

for k,v in c.items():
    if v < 2:
        continue

    if k > ma1:
        if v >= 4:
            ma2 = k
            ma1 = k
            continue
        else:
            ma2 = ma1
            ma1 = k
    elif k > ma2:
        ma2 = k

print(ma1*ma2)
# Judge status: Wrong Answer
d,t,s=map(int,input().split())
if d//s>t:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
N,L=map(int,input().split())
v=[L+i for i in range(N)]
s=sum(v)
ans=10**9
for i in range(N):
    if abs(s-(s-v[i]))<abs(s-ans):
        ans=s-v[i]
print(ans)
# Judge status: Wrong Answer
s=list(input())
if int(s[5])==1:
    print("TBD")
elif int(s[6])>=5:
    print("TED")
else:
    print("Heisei")
# Judge status: Accepted
S = input()
if "a" in S and "b" in S and "c" in S:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
if p>=q and  p>r:
    print(q+r)
if q>=p and q>r:
    print(p+r)
if r>=q and r>p:
    print(q+p)
if r==p and p==q:
    print(p+q)
# Judge status: Accepted
N, M = list(map(int, input().split()))
s, r = divmod(M, N)
ans = 1
for i in range(s, 0, -1):
    if M % i == 0:
        print(i)
        break
# Judge status: Accepted
S = input()
n = len(S) // 2

if 'hi' * n == S:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
print(eval(input().replace(*' %'))%2)
# Judge status: Accepted
n=int(input())
data=[list(map(int,input().split())) for _ in range(n)]
x_past=0
y_past=0
t_past=0
for t,x,y in data:
  if abs(x-x_past)+abs(y-y_past)>t-t_past:
    print("No")
    exit()
  if (abs(x-x_past)+abs(y-y_past))%2!=(t-t_past)%2:
    print("No")
    exit()
  x_past=x
  y_past=y
  t_past=t
print("Yes")
# Judge status: Wrong Answer
w,h,x,y=map(int,input().split())

if x==w or x==0:
    if y==h or y==0:
        print(0,"1")
else:
    w2=int(w//2)
    h2=int(h//2)

    s1=h*w2
    s2=w*h2
    if s1>s2:
        print(s1,"0")
    elif s1==s2:
        print(s1,"1")
    else:
        print(s2,"0")
# Judge status: Wrong Answer
a,b,c = sorted(list(map(int,input().split())))
if a == c:
    print("1")
elif a == b | b == c:
    print("2")
else:
    print("3")
# Judge status: Accepted
N,M=(int(x) for x in input().split())
#N=int(input())
#A=list(map(int, input().split()))

if N>=2:
    a=int(N*(N-1)/2)
else:
    a=0

if M>=2:
    b=int(M*(M-1)/2)
else:
    b=0

print(a+b)
# Judge status: Accepted
n = int(input())
A = [int(x) for x in range(1,34000)]
for i in range(33999):
    A[i] = A[i]**2

B = [i for i in A if i <= n]

print(max(B))
# Judge status: Accepted
k,m=map(int,input().split())
l=[0 for i in range(k+1)]
for i in range(m):
  a,s=map(int,input().split())
  l[a-1]+=1;l[s]-=1
ans=0
f=0
for j in range(k):
  l[j]+=f
  f=l[j]
print(len([1 for i in l if i==m]))
# Judge status: Accepted
a,b,c,d = map(int,input().split())

import math
LCM=c * d //math.gcd(c, d)

tmp1=b//c + b//d - b//LCM #1~bまで調べたとき、割り切れる数の個数
tmp2=(a-1)//c + (a-1)//d - (a-1)//LCM #1~a-1まで調べたとき、割り切れる数の個数
tmp=tmp1-tmp2 #a~bまで調べたとき、割り切れる数の個数
ans=(b-a+1)-tmp

print(ans)
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
cnt=0
num=1
for i in range((min(A,B)),0,-1):
    if A%i==0 and B%i==0:
            cnt+=1
            num=i
    if cnt==K:
        break
print(num)
# Judge status: Accepted
N,A,B=map(int,input().split())
print(max(0,B*(N-1)+A-(A*(N-1)+B)+1))
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
A = sorted(A, reverse=True)
d = defaultdict(int)
for i in range(N):
  d[A[i]] += 1
d = sorted(d.items(), key=lambda x:x[1], reverse=True)
d = sorted(d, key=lambda x:x[0], reverse=True)
a = []
for key, val in d:
  if 2 <= val <= 3:
    a.append(key)
  elif val >= 4:
    a.append(key)
    a.append(key)
  if len(a) >= 2:
    print(a[0]*a[1])
    exit()
if len(a) < 2:
  print(0)
# Judge status: Accepted
k,x=map(int,input().split())
import numpy as np
#print(x-k+1,x+k-1+1)
a=[str(ii) for ii in np.arange(x-k+1,x+k-1+1)]
print(" ".join(a))
# Judge status: Accepted
#!/usr/bin/env python3
n, k = map(int, open(0).read().split())
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
print(len(Base_10_to_n(n, k)))
# Judge status: Accepted
l,r,d=map(int,input().split())
if l%d == 0:
  print((r//d)-(l//d)+1)
else:
  print((r//d)-(l//d))
# Judge status: Wrong Answer
n = int(input())
number = input().split(" ")
ans = 0
for i in range(n-2):
    if number[i] >= number[i+1] and number[i+1] >= number[i+2]:
        ans += 1
    elif number[i] <= number[i+1] and number[i+1] <= number[i+2]:
        ans += 1
    else:
        pass
print(ans)
# Judge status: Accepted
inf = 10**15
mod = 10**9+7
n,m,x,y = map(int, input().split())
xlist = list(map(int, input().split()))
ylist = list(map(int, input().split()))
xmax = max(xlist)
ymin = min(ylist)
if xmax < ymin and xmax < y and ymin > x:
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
yen = int(input())
count = 0

while yen - 500 > 0:
    yen -= 500
    count += 1000

while yen - 5 > 0:
    yen -= 5
    count += 5

print(count)
# Judge status: Wrong Answer
N = int(input())

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

total1 = 0
total2 = 0

for i in range(N):
    if a[i]>b[i]:
        total1 += a[i]-b[i]
    else:
        total2 += b[i]-a[i]

if total1 <=total2/2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x, y = map(int, input().split())

if x % y == 0:
    print('-1')
else:
    print(x)
# Judge status: Accepted
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    print(min(A-1,N-B)+1+(B-A-1)//2)
# Judge status: Wrong Answer
a = input()

for i in range (4):
     
   if a[0]==a[1] or a[0]==a[2] or a[0]==a[3] and a[1]==a[2] or a[1]==a[3] or a[2]==a[3]:
      print("Yes")
   else:
       print("No")
   break
# Judge status: Accepted
import re

s = input()
ptn = re.compile(r'maerd|remaerd|resare|esare')
tmp = s[::-1]

while(True):
  res = re.match(ptn , tmp)
  if res is None:
    break
  tmp = tmp.replace(res.group(),'',1)

if len(tmp) == 0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
k,s=map(int,input().split())
ans=0
for x in range(0,k+1):
            for y in range(0,k+1):
                        z=s-x-y
                        if 0<=z<=k:
                                    ans+=1
                                                
print(ans)
# Judge status: Accepted
cmatrix = []
for i in range(3):
  cmatrix.append(list(map(int, input().split())))
  
if(cmatrix[0][0]+ cmatrix[1][1] == cmatrix[0][1]+ cmatrix[1][0] and \
  cmatrix[0][1]+ cmatrix[1][2] == cmatrix[0][2]+ cmatrix[1][1] and \
  cmatrix[1][0]+ cmatrix[2][1] == cmatrix[1][1]+ cmatrix[2][0] and \
  cmatrix[1][1]+ cmatrix[2][2] == cmatrix[1][2]+ cmatrix[2][1]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if a>=13:
	print(b)
elif a>=6:
	print(int(b/2))
else:
	print(0)
# Judge status: Accepted
mod = 998244353
N = int(input())
D = list(map(int,input().split()))
from collections import Counter
if D[0] != 0 or 0 in D[1:]:
    print(0)
else:
    dc1 = Counter(D[1:])
    dc = [0 for i in range(max(D))]
    for k,v in dc1.items():
        dc[k-1] = v
    ans = 1
    for i in range(1,len(dc)):
        if dc[i] == 0:
            ans = 0
            break
        ans = (ans*(dc[i-1]**dc[i]))%mod
    print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
S=list(input())

c,s=0,S[0]
for n in S[1:]:
  if s==n:
    c+=1
  s=n

print(min(N-1,c+2*K))
# Judge status: Accepted
N = int(input())
A = {}
S = 0
MS = 0
for i in range(2):
    A[i] = list(map(int,input().split()))
for i in range(N):
    S = 0
    for j in range(i+1):
        S += A[0][j]
    for k in range(N-i):
        S += A[1][N-k-1]
    if S > MS:
        MS = S
print (MS)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

flag = True

x = h[0] - 1

for i in range(1, n):
    if h[i] < x:
        flag = False
        break
    elif h[i] == x:
        pass
    else:
        x = h[i] - 1
    
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
S = input()

E = [0] * (N + 1)
W = [0] * (N + 1)
for i, s in enumerate(S):
    E[i + 1] = E[i] + (s == 'E')
    W[i + 1] = W[i] + (s == 'W')

ans = N
for i in range(1, N):
    L = W[i - 1]
    R = E[N] - E[i]
    ans = min(ans, L + R)

print(ans)
# Judge status: Accepted
N, K, S = map(int, input().split())

res = []
for x in range(K):
    res.append(S)

q = N - K

fix = round(1e9) if S != 1e9 else round(1e9 - 1)

for _q in range(q):
    res.append(fix)

print(' '.join(map(str, res)))
# Judge status: Wrong Answer
import math

A, B, C, D = map(int, input().split())
CD = int(C * D / math.gcd(C, D))

B_in_C = int(B/C)
B_in_D = int(B/D)
B_in_CD = int(B/(CD))
B_con = B - (B_in_C + B_in_D - B_in_CD)

A = A-1 if A > 1 else A
A_in_C = int(A/C)
A_in_D = int(A/D)
A_in_CD = int(A/(CD))
A_con = A - (A_in_C + A_in_D - A_in_CD)

print(B_con - A_con)
# Judge status: Accepted
H, A = map(int, input().split())

X = H//A

print(X if H%A == 0 else X+1)
# Judge status: Accepted
from collections import defaultdict
n,m=map(int,input().split())
a=[int(i) for i in input().split()]
a.sort()
bc=defaultdict(int)
for i in range(m):
  b,c=map(int,input().split())
  bc[c]+=b
i=0
newc=[0]*n
for c,b in sorted(bc.items(),key=lambda x:x[0],reverse=True):
  for _ in range(b):
    if i==n:
      break
    newc[i]=c
    i+=1
ans=sum(a)
for i in range(n):
  if newc[i]>a[i]:
    ans+=newc[i]-a[i]
print(ans)
# Judge status: Accepted
S = input()
ans = ""
flag = 0
for s in S[::-1]:
  if s == "B":
    flag += 1
    continue
  if flag:
    flag -= 1
    continue
  ans += s
print(ans[::-1])
# Judge status: Wrong Answer
n = int(input())
w = list(map(int, input().split()))
sumW = sum(w)
halfW = sumW//2
t = 0
for i in w:
  t += i
  if t >= halfW:
    break
print(abs(sumW - 2*t))
# Judge status: Accepted
import collections
a = int(input())
words = [input() for i in range(a)]
c = collections.Counter(words)
key = len(c.keys())
tmp = 0
for i in range(len(words)-1):
	if len(words) == key:
		if words[i][-1] == words[i+1][0]:
			tmp += 1
		else:
			tmp = 0
	else:
		break
if tmp == len(words)-1:
	print("Yes")
else:
	print("No")
# Judge status: Accepted

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

print (min(N % K , K - N % K))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
G=1000
K=0
for i in range(N-1):
  if A[i+1]>A[i]:
    K=G//A[i]
    G=G % A[i]
  if A[i+1]<A[i]:
    G=G+A[i]*K
    K=0
G=G+A[N-1]*K
print(G)
# Judge status: Accepted
def main():
  import sys
  import math
  input = sys.stdin.readline
  a,b=map(int,input().split())
  if b>=10:
    for i in range(b*10,b*10+10):
      if a==math.floor(i*0.08):
        print(i)
        exit()
    print(-1)
  else:
    for i in range(b*10,b*10+10):
      if a==math.floor(i*0.08):
        print(i)
        exit()
    print(-1)
if __name__=='__main__':
  main()
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=0
res=float('inf')
for i in range(n):
  if abs(t-h[i]*float(0.006)-a)<res:
    res=abs(t-h[i]*float(0.006)-a)
    ans=i+1
print(ans)
# Judge status: Wrong Answer
s=list(input())
s=list(set(s))
s.sort()
import string
l=string.ascii_lowercase
ans="None"
for i in range(len(s)):
  if s[i]!=l[i]:
    ans=l[i]
    break
if len(s)==1 and s[0]=="a":
  ans="b"
print(ans)
# Judge status: Accepted
N = str(input())
L = len(N)
ans = 0
dp = [[0,0] for _ in range(L)]
s = list(map(int,N))
dp[0] = [s[0],11-s[0]]
for i in range(1,L):
    n = s[i]
    dp[i][0] = min(dp[i-1][0]+n,dp[i-1][1]+n)
    dp[i][1] = min(dp[i-1][1]+9-n,dp[i-1][0]+11-n)
print(min(dp[-1]))
# Judge status: Wrong Answer
H,A=map(int,input().split())
B=0
C=0
for i in range(0,H):
    B=B+A
    if B<=H:
        C=C+1
        print(C)
        break
    else:
        C=C+1
# Judge status: Accepted
a=int(input())
ans=0
if a % 2 ==1:
  ans=round((a+1)/2)
else:
  ans=round(a/2)
print(ans)
# Judge status: Accepted
import sys


INF = sys.maxsize

N, K = (int(x) for x in input().split())
heights = [int(x) for x in input().split()]

memo = [INF] * N

for i in range(N - 1, -1, -1):
  if i == N - 1:
    # ゴールからゴールの距離を0で初期化
    memo[i] = 0
    continue
  cost = INF
  for j in range(1, K + 1):
    # 範囲外
    if i + j >= N:
      continue
    cost = min(cost, memo[i + j] + abs(heights[i] - heights[i + j]))
  memo[i] = cost             

print(memo[0])
# Judge status: Accepted
N =int(input())
a =[int(i) for i in input().split()]

j =a[0] 
k =0
for i in range(1,N):
  k += a[i]
  
ans =abs(j-k)
  
for x in range(1,N-1):
  j += a[x]
  k -= a[x]
  ans = min(ans,abs(j-k))
  
  
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

flag = 0
for i in range(N-1):
    if A[i] != A[i+1]:
        flag = 0
    else:
        flag = 1

if flag == 0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N):
    tmp_ans = 0
    for a in A:
        if a - 1 > i:
            continue
        elif a + 1 < i:
            break
        else:
            tmp_ans += 1
    if tmp_ans > ans:
        ans = tmp_ans
print(ans)
# Judge status: Wrong Answer
N = int(input())
S = list(str(input()))
count1,count2 = 0,0
j = 0
for i in range(N-1,-1,-1):
  if S[i] == "#":
    j = i
    break
count1 = S[:j+1].count("#")
for i in range(1,N):
  if S[i-1] == "#" and S[i] == ".":
    count2 += 1
    S[i] = "#"

print(min(count1,count2))
# Judge status: Accepted
def main():
  n = int(input())
  bef = 0
  ans = 0
  for i in range(n):
    now = int(input())
    ans += min(bef, now)
    now -= min(bef, now)
    ans += now//2
    bef = now % 2
  print(ans)
  
if __name__ == "__main__":
  main()
# Judge status: Accepted
N = int(input())
d = list(map(int, input().split()))
d.sort()
dv = N//2
print(d[dv] - d[dv-1])
# Judge status: Accepted

import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


n,k = readints()
a = readints()

l = 0
r = 10**10

while r-l>1:
    m = (l+r)//2
    x = [(a[i]-1)//m for i in range(n)]
    if sum(x)<=k:
        r = m
    else:
        l = m

print(r)
# Judge status: Wrong Answer
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
for i in range(n):
    if a[i]<=b[i]:
        x=b[i]-a[i]
        a[i]=a[i]+2*x
        b[i]=b[i]+x
# print(a,b)
for i in range(n):
    if a[i]>10**9 or b[i]>10**9:
        print('No')
        exit()
    if a[i]!=b[i]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
s = input()
for i in s:
    if i == "1":
        continue
    else:
        print(i)
        exit()
# Judge status: Wrong Answer
N = int(input())

ans = 0
for i in range(1, N + 1):
    start = i
    n = N // i
    end = i * n
    ans += n * (n + 1) // 2


print(ans)
# Judge status: Wrong Answer
s, t = map(str, input().split())
print(s + t)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()
print(a[0]+a[1])
# Judge status: Accepted
n=int(input())
a=[int(x) for x in input().split()]
s=all([x%2==0 for x in a])
ans=0
while s:
    s=all([x%2==0 for x in a])
    if s:
        ans+=1
    for i in range(n):
        a[i]=a[i]//2
print(ans)
# Judge status: Wrong Answer
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    def judge():
        for x in A:
            if x % 2 == 0:
                if x % 3 != 0 or x % 5 != 0:
                    return False
        return True

    if judge():
        print("APPROVED")
    else:
        print("DENIED")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A, V =map(int, input().split())
B, W =map(int, input().split())
T=int(input())

d=abs(B-A)
dv=V-W

if dv<=0:
    print("NO")
elif d%dv !=0 :
    print("NO")
elif d/dv > T:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
N = int(input())
*b, = map(int, input().split())
ans = []

for i in range(N)[::-1]:
    n = i+1
    if b[i]:
        ans.append(n)
        for j in range(1, int(n**0.5)+1):
            if n%j==0:
                b[j-1] ^= 1
                if j!=n//j:
                    b[n//j-1] ^= 1

M = len(ans)
print(M)
if ans:
    print(*ans)
# Judge status: Accepted
N = int(input())
ans = 1000000
for i in range(1, N+1):
    A = i
    B = N - i
    if A <= B:
        Asum = sum(map(int, str(A)))
        Bsum = sum(map(int, str(B)))
        if ans > (Asum + Bsum):
            ans = Asum + Bsum
print(ans)
# Judge status: Wrong Answer
def make_divisors(n):
    count = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            count += 1
            if i != n // i:
                count +=1

    return count

N = int(input())
S = [0 for i in range(N - 1)]
for i in range(1, N):
    if(i == 1):
        S[i-1] = 1
    else:
        div_count = make_divisors(i)
        
        S[i-1] = S[i-2] + div_count
# Judge status: Accepted
a, b, c, k = map(int, input().split())
if k <= a:
    print(k)
elif a < k <= (a+b):
    print(a)
else:
    num = k-a-b
    print(a-num)
# Judge status: Accepted
n=input().split()
A=int(n[0])
B=int(n[1])

if 13<=A:
    print(B)
elif 6<=A<=12:
    print(int(B/2))
elif A<=5:
    print("0")
# Judge status: Accepted
s=input()
a=len(s)
cnt=0
l=0
r=1
W='aaa'
while r<a+1:
  if s[l:r]!=W:
    cnt+=1
    W=s[r-1:r]
    r+=1
    l=r-1
  else:
    cnt+=1
    W=s[r-1:r+1]
    r+=2
    l=r-1
if r!=a+1:
  cnt-=1
print(cnt)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
k=int(input())
d=b
e=c
while a>b:
  b=b*2
while b>c:
  c=c*2
f=b/d
g=c/e
h=f//2
i=g//2
if k>=h+i:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
S = list(input())
cnt = 0
if N % 2 == 1:
    print("No")
else:
    for i in range(1,N//2 + 1):
        if S[i-1] != S[N//2 + i - 1]:
            cnt = 1
    if cnt == 0:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    q,h,s,d = map(int,input().split())
    n = int(input())
    q=4*q
    h=2*h
    d=d//2
    p1=min(q,h,s)
    p2=min(2*s,2*d)

    if n%2==0:
        print(n*p2)
    else:
        c=n//2
        print(c*p2+p1)

if __name__=="__main__":
    main()
# Judge status: Accepted
L = list(map(int,input().split()))

print(L[0]+L[1]//2)
# Judge status: Accepted
from sys import stdin as s
from math import sqrt as sq
lx=[]
ly=[]
c=0
n=int(s.readline())
for i in range(n):
  x,y=map(int,s.readline().split())
  lx.append(x)
  ly.append(y)
for i in range(n):
  for j in range(i+1,n):
    c+=sq((lx[i]-lx[j])**2+(ly[i]-ly[j])**2)
print(c*2/n)
# Judge status: Accepted
n, k  = map(int, input().split())
h = sorted(map(int, input().split()))
# print(h)
if k >= len(h):
    k = len(h)
for _ in range(k):
    h.pop(-1)

answer = sum(h)
print(answer)