peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a, b, c = map(str, input().split())

sor_len_list = sorted([len(a), len(b), len(c)])

if sor_len_list == [5, 5, 7]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
S = list(input())
Q = int(input())
A = []
a = 0
for i in range(Q):
  q = list(input().split())
  if q[0] == '1':
    a += 1
  else:
    if (q[1] == '1' and a % 2 == 0) or (q[1] == '2' and a % 2 == 1):
      A.append(q[2])
    else:
      S.append(q[2])
A = A[::-1]
S = A + S
if a % 2 == 1:
  S = S[::-1]
ans = ''.join(S)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = a[0::2]
cnt = 0

for i in range(len(ans)):
  if (ans[i] % 2) != 0:
    cnt += 1
    
print(cnt)
# Judge status: Accepted
N,M,X = map(int,input().split())
books = {}
for i in range(N):
    books[i] = list(map(int,input().split()))

min_ = 10**10

for i in range(2**N):
    understanding = [0 for j in range(M)]
    cost = 0
    for j in range(N):
        if (i>>j)&1:
            for k in range(M):
                understanding[k] += books[j][k+1]
            cost += books[j][0]
    if all([a >= X for a in understanding]):
        min_ = min(min_,cost)

if min_ == 10**10:
    min_ = -1
print(min_)
# Judge status: Wrong Answer
n = int(input())
l = []
for i in range(n):
    x, y = input().split()
    l.append([i, x, int(y)])
l = sorted(l, key=lambda x:(x[1], x[2]))
for i in l:
    print(i[0])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
kouho = set()

for i in range(N):
    if i == 0:
        continue
    elif A[i-1] == A[i]:
        kouho.add(A[i])
        if A.count(A[i]) >= 4 or len(kouho) >= 2:
            break
else:
    ans = 0

kouho = list(kouho)

if len(kouho) >= 2:
    ans = kouho[0] * kouho[1]
elif len(kouho) == 1:
    ans = kouho[0] ** 2

print(ans)
# Judge status: Wrong Answer
X = input()
Y = int(X) / 500
Z = (int(X) - Y * 500) / 5
print(Y * 1000 + Z * 5)
# Judge status: Wrong Answer
C = print(chr(ord(input("input:")) + 1))
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(1,n+1):
  if len(str(i))%2 != 0:
    cnt += 1
print(cnt)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))

ans = 0
for i in range(N):
	ans += L[i]
if max(L) < sum(L)-max(L):
	print("Yes")
else:
	print("No")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
dic={}
out=0

for num in a:
    if num in dic.keys():
        out=1
        break
    else:
        dic[num]=1

if out==0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n=int(input())
s=input()
left=set()
ans=0

for i in range(n-1):
    left.add(s[i])
    right=set()
    for j in range(i+1,n):
        right.add(s[j])
    cnt=0
    for ll in left:
        if ll in right:
            cnt+=1
    ans=max(ans,cnt)

print(ans)
# Judge status: Accepted
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
sums = [sum(A1[:i])+sum(A2[i-1:]) for i in range(1,N+1)]
print(max(sums))
# Judge status: Accepted
A,B,T= map(int,input().split())
print((T//A)*B)
# Judge status: Accepted
X = int(input())

a = X // 100
b = X % 100

m = 5*a

if b > m:
  print(0)
else:
  print(1)
# Judge status: Accepted
def FizzBuzzSum():
  N = int(input())
  sum=0
  for i in range(N+1):
    if i%3!=0 and i%5!=0:
      sum=sum+i
  return sum
print(FizzBuzzSum())
# Judge status: Accepted
S = input()
T = input()

Sd = {}
Sl = []
for c in S:
    if c not in Sd:
        Sd[c] = len(Sd)
    Sl.append(Sd[c])

Td = {}
Tl = []
for c in T:
    if c not in Td:
        Td[c] = len(Td)
    Tl.append(Td[c])

print('Yes' if Sl == Tl else 'No')
# Judge status: Accepted
from math import gcd
N = int(input())
A = list(map(int,input().split()))
num = gcd(A[0],A[1])
for i in range(2,N):
    num = gcd(num,A[i])
print(num)
# Judge status: Accepted
_,a,b,*t = [list(map(int,i.split())) for i in open(0)]
n=min(a)+min(b)
for x,y,c in t:n=min(n,a[x-1]+b[y-1]-c)
print(n)
# Judge status: Wrong Answer
n,m = list(map(int,input().strip().split()))

path = [[] for i in range(n)]

for i in range(m):
  a,b = list(map(int,input().split()))
  path[a-1].append(b-1)
  path[b-1].append(a-1)

for j in path[0]:
  if m-1 in path[j]:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
# Judge status: Accepted
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
m=math.ceil(pow(2*n+1/4,0.5)-1/2)
s=m*(m+1)//2
for i in range(1,m+1):
  if i!=s-n:
    print(i)
# Judge status: Wrong Answer
x=int(input())
a=x//100
b=x%100
print(a,b)
if b>=0 and b<=5*a:
    print("1")
else:
    print("0")
# Judge status: Accepted
s = str( input() )
t = str( input() )

def compare( s, t ):
    count = 0
    for i in range( len( s ) ):
        if s[ i ] != t[ i ]:
            count += 1
    return count

ans = 10 ** 10
for i in range( len( s ) - len( t ) + 1 ):
    ans_i = compare( s[ i : i + len( t ) ], t )
    if ans_i < ans or i == 0:
        ans = ans_i

print( ans )
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()

import bisect
import numpy as np
amax = a[-1]
cent = amax // 2

if len(a) == 2:
    print(max(a), min(a))
elif cent in a:
    print(amax, cent)
else:
    idx = bisect.bisect_left(a, cent)
    max_idx = np.argmin([abs(a[idx]-cent), abs(a[idx+1]-cent)])
    if max_idx:
        print(amax, a[idx+1])
    else:
        print(amax, a[idx])
# Judge status: Accepted
n = int(input())
sn = str(n)
k = len(sn)
c = int(sn[0])
if sn == str(c) + "9" * (len(sn) - 1):
    print(c + 9 * (k - 1))
else:
    print(c + 9 * (k - 1) - 1)
# Judge status: Accepted
import sys
N = int(sys.stdin.readline().rstrip())

cnt = [[0] * 10 for _ in range(10)]

for i in range(1, N + 1):
    i = str(i)
    cnt[int(i[0])][int(i[-1])] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)
# Judge status: Accepted
N, K = map(int,input().split())

H = []
for i in range(N):
    H.append(int(input()))

H.sort()
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, H[i+K-1]-H[i])

print(ans)
# Judge status: Accepted
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
d = {}
for i in list(set(s) | set(t)):
    d[i] = 0
for i in s:
    d[i] += 1
for i in t:
    d[i] -= 1
print(max(0, d[max(d, key=d.get)]))
# Judge status: Wrong Answer
N = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(N):
  if i%2==1 and arr[i]%2==1:
    ans += 1
print(ans)
# Judge status: Accepted
S=input()
T=[]

for i in range(len(S)):
    if S[i] in T:
        print("no")
        exit()
    else:
        T.append(S[i])
print("yes")
# Judge status: Accepted
S = input()
A = [0, 0]
for i in range(len(S)):
  if S[i] == "0":
    A[0] += 1
  else:
    A[1] += 1
print(2 * min(A))
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
sx = sorted(X)
lm = sx[N//2-1]
rm = sx[N // 2]
for i in range(N):
    if X[i] <= lm:
        print(rm)
    else:
        print(lm)
# Judge status: Accepted
S=input()
n=int(input())
t=0
L=""
R=""
for i in range(n):
    Q=list(input().split())
    if Q[0]=="1":
        if t==0:
            t=1
        else:
            t=0
    else:
        if int(Q[1])+t==2:
            R=R+Q[2]
        else:
            L=Q[2]+L
            
ans=L+S+R
if t==0:
    print(ans)
else:
    print(ans[::-1])
# Judge status: Accepted
n,m=map(int,input().split())
x=list(map(int,input().split()))

x.sort()
dif=[]
for i in range(1,m):
    dif.append(x[i]-x[i-1])
dif.sort()

if n>=m:
    print(0)
else:
    print(sum(dif[:m-n]))
# Judge status: Accepted
import math

n = int(input())
players = [int(x) for x in input().split()]
players.sort(reverse = True)
comfortness = 0
for i in range(n-1):
    comfortness += players[math.ceil(i/2)]

print(comfortness)
# Judge status: Accepted
N, M = map(int, input().split())
lr = [tuple(map(int, input().split())) for _ in range(M)]

s = [0] * (N + 1)
for i in range(M):
    l, r = lr[i]
    s[l - 1] += 1
    if r != N + 2:
        s[r] -= 1

ruiseki = [0] * (N + 2)
for i in range(N + 1):
    ruiseki[i + 1] += ruiseki[i] + s[i]

#max_ = max(ruiseki)
print(ruiseki.count(M))
# Judge status: Accepted
import math
a,b,c,d=map(int, input().split())
def gcd(a,b):
    if(a%b!=0):
        return gcd(b,a%b)
    else:
        return b
def lcm(a,b):
    return a*b//gcd(a,b)

numb = b-(b//c + b//d) + (b//(lcm(c,d)))
numa = (a-1)-((a-1)//c+(a-1)//d) + ((a-1)//lcm(c,d))
print(numb-numa)
# Judge status: Accepted
def wab(w,a,b):
    ans = 0
    if w+a >= b and a <= b or a <= b+w and a >= b:
        return ans
    ans = b - (w + a) if a < b else a - (w + b)
    return ans

def main():
    W , a , b = map(int, input().split())
    print(wab(W , a , b))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a = input()

b = a.upper()

print("A") if a==b else print("a")
# Judge status: Accepted
s=input()
ok=True
for i in s:
    if s.count(i)%2 != 0:
        ok=False
        break
if ok:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,x,t=map(int,input().split())
if n/x==0:
  print(n/x*t)
else:
  print((n//x+1)*t)
# Judge status: Accepted
K,A,B = map(int,input().split())

if A + 2 > B:
    print(K + 1)
    exit()

start = A - 1
K -= start
ans = K//2 * (B-A) + K%2 + start + 1
print(ans)
# Judge status: Accepted
c1=input()
c2=input()
if c1[0]==c2[2] and c1[1]==c2[1] and c1[2]==c2[0]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
(h,n),*c=[[*map(int,i.split())]for i in open(0)]
dp=[10**9]*(2*10**4+1)
c.sort()
dp[0]=0
for i in range(h):
    for a,b in c:
        if i+a<=2*10**4:
            dp[i+a]=min(dp[i+a],dp[i]+b)
        else:break    
print(min(dp[h:]))
# Judge status: Accepted
A,B=map(int,input().split())

if (A+B)%2==0:
    print(int((A+B)/2))
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
x = int(input())

if x >= 30:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import sys
def input():
    return sys.stdin.readline()[:-1]

a,b,t = map(int,input().split(' '))
M = max(a,b,t)*10
m = min(a,b,t)
print(min(a,b,t)+max(a,b,t)*10+a+b+t-M-m)
# Judge status: Accepted
import itertools as it
import numpy as np
import math

N = int(input())
A =[]

for i in range (0, N):
    A.append(list(map(int, input().split())))

A = np.array(A)

L = list(it.permutations(range(0,N)))

distance = 0

for i in range (0, len(L)):
    for j in range (1, N):
        distance+=math.sqrt((A[L[i][j]][1]-A[L[i][j-1]][1])**2+(A[L[i][j]][0]-A[L[i][j-1]][0])**2)

print(distance/math.factorial(N))
# Judge status: Accepted
N,A,B= map(int, input().split())

c=(A+B)*(N//(A+B))
s=A*(N//(A+B))

if c+A<=N:
    print(s+A)
else:
    print(s+N-c)
# Judge status: Accepted
n = int(input())

print(n*800 - 200*(n//15))
# Judge status: Wrong Answer
x=int(input())
data=[x//100+1,x//101+1,x//102+1,x//103+1,x//104+1]
if x<100:
  print(0)
  exit()
for i in range(data[0]):
  for j in range(data[1]):
    for k in range(data[2]):
      for l in range(data[3]):
        for m in range(data[4]):
          if (x-(100*i+101*j+102*k+103*l+104*m))%105==0:
            print(1)
            exit()
print(0)
# Judge status: Wrong Answer
S = list(input().strip())
ans = [0] * len(S)
for i in range(len(S)):
    right = 0
    left = 0
    for l in range(i, -1, -1):
        if S[l] == "<":
            left += 1
        else:
            break
    for r in range(i+1, len(S)):
        if S[r] == ">":
            right += 1
        else:
            break
    ans[i] = max(right, left)

print(sum(ans))
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
na=sorted(a)
Alice=0
Bob=0

for i in range(N):
    if i%2==0:
        Alice+=na[i]
    else:
        Bob+=na[i]

print(Alice-Bob)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))

cnt = 0
ans = 0

for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cnt += 1

        if cnt > ans:
            ans = cnt
            cnt = 0

if cnt > ans:
    ans = cnt

print(ans)
# Judge status: Accepted
k = int(input());
a, b = map(int, input().split());

if (a // k) * k == a or (a // k + 1) * k <= b:
  print("OK");
else:
  print("NG");
# Judge status: Accepted
X=int(input())
max = 1
for i in range(2,33):
    k = 2
    while True:
        n = i**k
        if n > X:
            break
        if n > max:
            max = n
        k += 1
print(max)
# Judge status: Accepted
a,b=map(int,input().split())
if (a+b)%2!=0:
    print((a+b)//2+1)
else:
    print((a+b)//2)
# Judge status: Wrong Answer
n = int(input())

A = sorted(list(map(int, input().split())), reverse=True)

score_list = [0]
for i in range(1, len(A)):
    score_list.append(A[i])
    score_list.append(A[i])
    
print(sum(score_list[:n-1]))
# Judge status: Wrong Answer
from collections import defaultdict

S = int(input())

if S <= 2:
    print(0)
    exit()
if S <= 3:
    print(1)
    exit()
if S <= 6:
    print(2)
    exit()

q = int(1e9+7)

result = [0]*S
result[3] = 1
result[4] = 1
result[5] = 1

for i in range(3, S - 1):
    for j in range(i + 3, S - 1):
        result[j] = (result[j] + result[i]) % q

ans = 0
for r in result:
    ans = (ans + r) % q

print(ans)
# Judge status: Wrong Answer
X,N=map(int,input().split())
P=list(map(int,input().split()))
p=[]
for j in range(X*2):
    if j in P:
        a=0
    else:
        p.append(j)
result=1000
answer=1000
for i in range(X*2-N):
    if abs(X-p[i])<result:
        answer=p[i]
        result=abs(X-p[i])
    elif abs(X-p[i])==result and p[i]<=answer:
        answer=p[i]
print(answer)
# Judge status: Accepted
from sys import stdin

def main():

    input = stdin.readline

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

    ans = 0

    ans += comb(N,2)
    ans += comb(M,2)

    print(ans)


def comb(n,k):
    min_k = min(k,n-k)

    if n < 2:
        return 0

    n_kaijyo = 1
    k_kaijyo = 1
    for i in range(min_k):
        n_kaijyo = n_kaijyo * (n - i)
        k_kaijyo = k_kaijyo * (i + 1)

    result = int(n_kaijyo / k_kaijyo)
    return result
    
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n=int(input())
l_b=2
l=1
if n==0:
  print("2")
elif n==1:
  print("1")
else:
  for i in range(2,n):
    l_bb=l_b
    l_b=l
    l=l_b+l_bb
  print(l)
# Judge status: Wrong Answer
#台形
def ABC_45_A():
    a = int(input())
    b = int(input())
    h = int(input())

    print((a+b)*h/2)


if __name__ == '__main__':

    ABC_45_A()
# Judge status: Accepted
n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(1,n+1):
    t[i],x[i],y[i]=map(int,input().split())
time=0
dist=0
for i in range(n):
    dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    time=t[i+1]-t[i]
    if time>=dist and time%2 == dist%2:
        continue
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
a,b,c=map(int, input().split())
ans=0
p=[a,b,c]
p.sort()
while p[0]!=p[2]:
    ans += 1
    if p[2]-2>p[0]: p[0] += 2
    else:
        p[0]+=1
        p[1]+=1
    p.sort()
print(ans)
# Judge status: Accepted
X = int(input())
# X = 1
stopFlag = 0
for i in range (-201, 201):
    a = i
    for j in range(-201, 201):
        if a**5 - j**5 == X:
            print (a, j)
            stopFlag = 1            
        if stopFlag:
            break
    if stopFlag:
        break
# Judge status: Accepted
import sys
x = int(input())
l = range(201)
for i in l:
  for j in l:
    if i**5+j**5 == x:
      print(' '.join([str(i),str(-j)]))
      sys.exit()
    elif i**5-j**5 == x:
      print(' '.join([str(i),str(j)]))
      sys.exit()
    else:
      pass
# Judge status: Wrong Answer
N=int(input())
for i in range(1,N//2+10):
	tmp=((i+1)*(i))//2
	if N-tmp<i+1:
		print(i+1)
		exit()
# Judge status: Accepted
s = input()

C = [0]*26

for i in s:
    C[ord(i)-ord('a')] += 1
res = "Yes"
for i in C:
    if i % 2 != 0:
        res = "No"
print(res)
# Judge status: Accepted
N = int(input())
cards = list(map(int, input().split()))
a = 0
b = 0

while True:
    if len(cards) == 0:
        break
    a += max(cards)
    cards.remove(max(cards))

    if len(cards) == 0:
        break
    b += max(cards)
    cards.remove(max(cards))

print(a - b)
# Judge status: Accepted
o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="")
# Judge status: Wrong Answer
a, b = input().split()
c = int(a + b)

for i in range(1,101):
  if i * i == a:
    print("Yes")
    break
else:
  print("No")
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 5:
    print(0)
elif a >= 6 and a <= 12:
    print(b//2)
else:
    print(b)
# Judge status: Accepted
S = str(input())
S = S.replace('eraser', '')
S = S.replace('erase', '')
S = S.replace('dreamer', '')
S = S.replace('dream', '')
if S == '':
  print('YES')
else:
  print('NO')
# Judge status: Accepted
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(M)]
R = sum(A,[])

for i in range(1,N+1):
    print(R.count(i))
# Judge status: Accepted
X,N=map(int, input().split())
lis = list(map(int, input().split()))
p=list(range(102))
# print(p)
for i in lis:
    p.remove(i)
# print(p)
d=10000
m=10000
for i in p:
    if d > abs(X-i):
        d = abs(X-i)
        m = i
print(m)
# Judge status: Accepted
a,b = map(int,input().split())
count = 0
for i in range(a,b+1):
    c = list(str(i))
    d = c[:2]
    e = c[:2:-1]
    if d == e:
        count += 1
print(count)
# Judge status: Wrong Answer
n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    print(A)
    S&=set(A)
print(len(S))
# Judge status: Accepted
n = int(input())
for i in range(10):
    if 2**i>n:
        print(2**(i-1))
        break
# Judge status: Accepted
n,y = map(int, input().split())
for a in range(n+1):
    for b in range(n+1):
        c = n - a - b
        if (10000*a + 5000*b + 1000*c) == y and a + b + c == n and c >= 0:
            print(a,b,c)
            exit(0)
print(-1,-1,-1)
# Judge status: Accepted
a,b,c,k=map(int,input().split())
ans=0
if k%2==0:
    ans=a-b
else:
    ans=b-a
if ans>10**18:
  print ('Unfair')
else:
  print (ans)
# Judge status: Accepted
#!/usr/bin/env python3

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

ans = 0
count = 0
for i in range(1, n):
    # print(h)
    # print(h[i-1], h[i])
    if h[i-1] >= h[i]:
        count += 1
    else:
        ans = max(count, ans)
        count = 0
    # print(count)
ans = max(count, ans)
print(ans)
# Judge status: Accepted
import bisect

def main():
    n = int(input())
    buf = []
    a = [None] * n
    for i in range(n):
        a[i] = int(input())
    for i in reversed(a):
        index = bisect.bisect_right(buf, i)
        if index < len(buf) and buf[index] > i:
            buf[index] = i
        else:
            buf.append(i)
    print(len(buf))

if __name__ == "__main__":
    main()
# Judge status: Accepted
S = input()
bl = 0
re = 0
for i in S:
  if i == "0":
    re += 1
  else:
    bl += 1
print(min(bl,re)*2)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))

if k >= n:
    print(0)
else:
    new_h = sorted(h)
    weak = list(new_h[:n-k])
    print(sum(weak))
# Judge status: Wrong Answer
str1 = input()
str2 = input()

alpha = str2[len(str1):]

if len(alpha) == 1 and alpha.isalpha():
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a = list(map(int, input().split()))

b = sorted(a)
print(b)
print("Yes" if b[0]+b[1] == b[2] else "No")
# Judge status: Wrong Answer
s = input()
s_list = list(s)
s_list.sort()

if s_list[0] == s_list[1] and s_list[2] == s_list[3]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
k, n = map(int, input().split())
A = list(map(int, input().split()))
D = []
for i in range(n-1):
    D.append(A[i+1]-A[i])
else:
    D.append(k-(A[n-1]-A[0]))
D.sort(reverse=True)
print(k-D[0])
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

S = list(input())
from collections import Counter
c = Counter(S)

if (c['N']==0 and c['S']!=0) or (c['N']!=0 and c['S']==0) or (c['E']==0 and c['W']!=0) or (c['E']!=0 and c['W']==0):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
h,n = map(int,input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i],b[i] = map(int,input().split())
dp = [0] * (h + 1)

for i in range(1,h+1):
    s = 100000000000
    for j in range(n):
        if i - a[j] < 0:
            s = min(s,b[j])
        else:
            s = min(s,dp[i-a[j]] + b[j])
    dp[i] = s
print(dp[h])
# Judge status: Wrong Answer
n,m=map(int,input().split())
x=list(map(int,input().split()))
x=sorted(x)

if n>=m:
    print(0)
    exit()

l=[]
for i in range(m-1):
    l+=[x[i+1]-x[i]]

l=sorted(l)
print(sum(l)-sum(l[-(n-1):]))
# Judge status: Accepted
N = int(input())
S = list(input())
m=0
sum=0
for i in S:
    if i == "I":
        sum+=1
    else:
        sum-=1
    m=max(sum, m)
print(m)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    ans = A - B
else:
    ans = B - A

if abs(ans) > pow(10, 18):
    print("Unfair")
else:
    print(ans)
# Judge status: Accepted
import queue

n,m = list(map(int, input().split()))
puted = [0]*(n+1)

ab = [[] for i in range(n+1)]
for i in range(m):
	a,b = list(map(int, input().split()))
	ab[a].append(b)
	ab[b].append(a)

q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)

while not q.empty():
	item = q.get()
	for i in ab[item]:
		if puted[i]==0:
			flg[i-1]=item
			q.put(i)
			puted[i]=1

if -1 in flg:
	print("No")
	exit()

print("Yes")
for i in range(1,len(flg)):
	print(flg[i])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

ans = 1
i = 0
while i < N - 2:
    if (A[i + 1] - A[i]) * (A[i + 2] - A[i + 1]) < 0:
        ans += 1
        i += 2
    else:
        i += 1
print(ans)
# Judge status: Accepted
d, n = map(int, input().split())
ans = (100**d)*n
if n == 100:
  ans += 100**d
print(ans)
# Judge status: Accepted
# ng, ok = 0, 10**9+1

n,k = map(int, input().split())
al = list(map(int, input().split()))
ng, ok = 0, 10**9+1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    ok_flag = True
    # ...
    cnt = 0
    for a in al:
        cnt += (a-1)//mid
    
    if cnt <= k:
        ok = mid
    else:
    	ng = mid
print(ok)
# Judge status: Accepted
N = int(input())

if N % 2 == 0:
  print(N // 2)
else:
  print(N // 2 + 1)
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
b=10**8
for i in range(1,101):
    b=min(b,sum((j-i)**2 for j in a))
print(b)
# Judge status: Wrong Answer
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if a[0]>x:
  ans -= a[0]-x
a[0] -= ans
for i in range(1,n):
  if (a[i]+a[i-1])>x:
    ans += ((a[i]+a[i-1]))-x
    a[i]-=  ((a[i]+a[i-1]))-x
print(ans)
# Judge status: Accepted
n, a, b = list(map(int, input().split(' ')))

ans = n // (a + b) * a
alp = min([n % (a + b), a])

print(ans + alp)
# Judge status: Wrong Answer
f=input;print('red' if int(f()) else input())
# Judge status: Accepted
h = int(input())
cnt = 0
while h > 1:
    h //= 2
    cnt += 1
print(2 ** (cnt + 1) - 1)
# Judge status: Accepted
s=str(input())

for i in range(len(s)):
    if i%2==0 and s[i]=="L":
        print("No")
        exit()
    
    elif i%2==1 and s[i]=="R":
        print("No")
        exit()

print("Yes")
# Judge status: Wrong Answer
X = list(map(int,input().split()))
A = X[0]
B = X[1]
C = X[2]
K = int(input())
cnt = 0
if A > B:
  for i in range(K):
   B = B*2
   cnt = cnt + 1
   if A < B:
    break
if B > C:
  for j in range(K):
   C = C*2
   cnt = cnt + 1
   if B < C:
    break
if cnt <= K:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n=int(readline())
    ans=int((1+n-1)/2 * (n-1))
    
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------