peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
Q, H, S, D = map(int, input().split())
N = int(input())

ans = 0
for w in range(N//2+1):
    for z in range(N-2*w+1):
        for y in range(2*(N-2*w-z)+1):
            x = 4 * (N - 2*w - z - y//2)
            ans = min(ans, Q*x + H*y + S*z + D*w)

print(ans)
# Judge status: Accepted
l,r,d = map(int,input().split())

cnt = 0
for i in range(l,r+1):
    if i % d == 0:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
od ="RUD"
ev="LUD"
res = "YES"
s = raw_input()
for i in xrange(len(s)):
    if i%2 ==0 :
        if s[i] not in od:
            res = "NO"
            break
    else:
        if s[i] not in ev:
            res = "NO"
            break
print res
# Judge status: Accepted
import sys
import functools
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
a=[1]*(n+1)
for i in range(m):
    a[int(input())]=0
@functools.lru_cache(maxsize=None)
def count(p):
    if p==0 or p==1:
        return a[p]
    if a[p]==1:
        x=count(p-1)+count(p-2)
        return x
    else:
        return 0
print(count(n)%1000000007)
# Judge status: Accepted
n, *a = map(int, open(0).read().split())
a.sort()

b = []
prev = cnt = 0
for i in range(n):
        if prev==a[i]: cnt+=1
        else:
                if cnt>1: b.append([prev, cnt])
                cnt = 1
        prev = a[i]
if cnt>1: b.append([prev, cnt])

h, w = 0, 0
for i, cnt in b:
        if cnt>3: h, w = i, i
        else: h, w = max(h, w), i
print(h*w)
# Judge status: Accepted
#! env python
# -*- coding: utf-8 -*-

import os
import sys


# ac_py.main
# Date: 2020/06/08
# Filename: main 
# Author: acto_mini

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    result = 0

    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
                if (500 * i + 100 * j + 50 * k) == X:
                    result += 1
    print(result)
    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b=map(int,input().split())
if b%a>0:print(b//a+1)
elif b<=a:print(1)
else:print(b//a)
# Judge status: Accepted
from math import gcd
x = int(input())
print((360//gcd(360, x)))
# Judge status: Accepted
S = input()
cnt = 0
for i in range(round(len(S) / 2)):
    if S[i] != S[len(S) - 1 - i]:
        cnt += 1
print(cnt)
# Judge status: Accepted
S=input()
N=len(S)
post=S[0]
ans=1
now=""
for i in range(1,N):
  now+=S[i]
  if post!=now:
    post=now
    now=""
    ans+=1
print(ans)
# Judge status: Wrong Answer
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
s = np.array([list(map(int, input().split())) for x in range(D)])

l_opt = s.argmax(axis=1)
for l in l_opt:
    print(l)
# Judge status: Wrong Answer
H = int(input())

cnt = 0
att = 1
while H > 1:
    H //= 2
    cnt += att
    att *= 2
    if H == 1:
        cnt += att
    
print(cnt)
# Judge status: Wrong Answer
import itertools
n = int(input())
s = [i for i in input()]
ans = 0
gr = itertools.groupby(s)
cnt = 0
for k, g in gr:
    if k == ".":
        if cnt == 0:
            cnt += 1
            continue
        else:
            ans += 1
    cnt += 1
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
H = []
for _ in range(n):
    H.append(int(input()))
H.sort()
Dif = [ H[i+k-1]-H[i] for i in range(n-k+1)]
print(min(Dif))
# Judge status: Accepted
def is_lunlun(n):
    m = str(n)
    for i in range(1,len(m)):
        if abs(int(m[i]) - int(m[i-1])) > 1:
            return False
    return True

def main():
    K = int(input())
    A = [format(str(i),"0>5") for i in range(100000) if is_lunlun(i)]
    B = [int(a1+a2) for a1 in A for a2 in A if int(a1+a2) < 3234566668 and is_lunlun(int(a1+a2))]
    B2 = sorted(set(B))
    print(B2[K])

if __name__ == "__main__":
    main()
# Judge status: Accepted
s = sorted(input())
if s[0] == 'a' and s[1] == 'b' and s[2] == 'c':
	print('Yes')
else:
	print('No')
# Judge status: Accepted
import sys
from collections import Counter
n = int(input())
res = Counter(sys.stdin.readline().strip())
for i in range(n - 1):
    s = sys.stdin.readline().strip()
    ct = Counter(s)
    ls = []
    for k, v in res.items():
        if ct[k] < v:
            ls.append(k)
    for l in ls:
        res[l] = ct[l]
res = "".join([i*j for i, j in res.items()])
print("".join(sorted(res)))
# Judge status: Wrong Answer
x=int(input())
if(360%x==0):
  print(360/x)
# Judge status: Accepted
from collections import Counter
S = list(input())

C = Counter(S)

ok = True
for s,x in C.items():
  if x % 2 != 0:
    ok = False
    break

if ok:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N,K = map(int,input().split())
d = {}
for i in range(N):
    a,b = map(int,input().split())
    d[a]= d[a]+b if a in d else b
dd = sorted(d)    
_sum = 0
for i in dd:
    _sum += d[i]
    if _sum >= K:
        print(i)
        exit()
# Judge status: Accepted
S = input()

first_0 = 0
first_1 = 0

for i, s in enumerate(S):
    if i % 2 == 0:
        if s == "0":
            first_1 += 1
        else:
            first_0 += 1
    else:
        if s == "0":
            first_0 += 1
        else:
            first_1 += 1

print(min(first_0, first_1))
# Judge status: Accepted
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]

ab.sort(key=lambda x: x[1])
t = 0
flag = True
for i in range(n):
    t += ab[i][0]
    if t > ab[i][1]:
        flag = False
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
D,N = map(int,input().split())

if D == 0:
    print(N)
else:
    print((100**D)*N)
# Judge status: Accepted
k=int(input())
print((k//2+k%2)*(k//2))
# Judge status: Wrong Answer
import sys
N,M=map(int, input().split())

if N<=100 and N>=1:
  if M==N:
    print("YES")
    sys.exit()
print("NO")
sys.exit()
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i+100*j+50*k:
                ans += 1

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    diff = a[i] + a[i + 1] - x
    if diff > 0:
        ans += diff
        a[i + 1] = max(0, a[i + 1] - diff)
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
ans = True
for a in A:
    if a % 2 == 0:
        if not (a % 5 == 0 or a % 3 == 0):
            ans = False
print("APPROVED" if ans else "DENIED")
# Judge status: Accepted
N,K=map(int,input().split())
A=[int(x)-1 for x in input().split()]
B=[0]
visited=[False]*N
for g,here in enumerate(B):
	if visited[here]:
		break
	visited[here]=True
	B.append(A[here])
s=B.index(here)
r=(K-s)%(g-s)
ans=B[s:][r]+1 if K>=s else B[K]+1
print(ans)
# Judge status: Accepted
def gcd(a,b):
    if a==0 :return b
    else : return gcd(b%a,a)

A,B=map(int,input().split())
p=set([1])
g=gcd(A,B)
for d in range(2,g):
    while g%d==0:
        p.add(d)
        g//=d
    if (d*d>=g): break
if g>=2:
    p.add(g)
print(len(p))
# Judge status: Accepted
def resolve():
    a,b=map(int,input().split())
    if a+b>=24:
        print(a+b-24)
    else:
        print(a+b)
resolve()
# Judge status: Accepted
A,B,C = map(int,input().split())
res = "NO"
if A == 5 or A == 7:
  if B == 5 or B == 7:
    if C == 5 or C == 7:
      if A+B+C == 17:
        res = "YES"
print(res)
# Judge status: Accepted
def main():
    N = int(input())
    S = str(input())
    if N % 2 == 1:
        print('No')
    elif N == 2:
        if S[0] == S[1]:
            print('Yes')
        else:
            print('No')
    else:
        n = (N // 2) - 1
        na = n + 1
        if S[0:n] == S[na:-1]:
            print('Yes')
        else:
            print('No')
main()
# Judge status: Accepted
import math
from decimal import Decimal
A, B, H, M = map(int, input().split())
theta = abs(11/2*M - 30*H)
rad = math.radians(theta)
cos = Decimal(math.cos(rad))
ans = math.sqrt(A**2 + B**2 - 2 * A * B * cos)
print("{:.020f}".format(ans))
# Judge status: Accepted
n=int(input())
if n%10==3:
    print("bon")
elif n%10==0 or n%10==1 or n%10==6 or n%10==8:
    print("pon")
else:
    print("hon")
# Judge status: Accepted
a, b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0: 
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
def is_kaibun(s):
    for i,c in enumerate(s):
        if c != s[len(s)-i-1]:
            return False
        if i > len(s)//2:
            break
    return True


s = input()
ans = "Yes"
if not is_kaibun(s):
#    print("S is not kaibun")
    ans ="No"
if not is_kaibun(s[0:(len(s)-1)//2]):
#    print("S-1 is not kaibun")
    ans ="No"
if not is_kaibun(s[(len(s)+3)//2-1:]):
#    print("S+3 is not kaibun")
    ans ="No"
print(ans)
# Judge status: Accepted
N = int(input())
primes = {}
for num in range(2, int(N**0.5)+1):
  while N%num == 0:
    if num in primes:
      primes[num] += 1
    else:
      primes[num] = 1
    N //= num
ans = 0
for p in primes.values():
  n = 1
  while n*(n+1)//2 <= p:
    n += 1
  ans += n-1
if N > 1:
  ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
x = 1
while True:
  if x**2 > N:
    break
  else:
    x +=1
print((x-1)**2)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
box = set([])
for i in range(n,0,-1):
  cnt = 0
  for j in range(1,n//i+1):
    if i*j in box:
      cnt += 1
  if cnt%2 != a[i-1]:
    box.add(i)
print(len(box))
print(*box)
# Judge status: Accepted
import itertools

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

for _ in range(K):
    B = [0] * N
    for i in range(N):
        l = max(0, i-A[i])
        r = min(N-1, i+A[i])
        B[l] += 1
        if r+1 < N:
            B[r+1] -= 1
    B = list(itertools.accumulate(B))
    A = B.copy()
    if A == [N] * N:
        break
print(*A)
# Judge status: Wrong Answer
N = input()
sum = 0
for n in range(len(N)):
    tmp = int(n)
    sum += tmp
    
if(sum % 9 == 0):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, m = map(int, input().split())
c = [input() for i in range(m)]
d = c[0]
for i in range(1,m):
    d += c[i]
e = sorted(d.replace(' ', ''))
for i in range(1,n+1):
    print(e.count(str(i)))
# Judge status: Wrong Answer
word1 = input()
word2 = input()
up = list(word1)
down = list(word2)

if up[0]==down[2] and up[1]== down[1] and up[2] == down[0]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
# B - ROT N
# https://atcoder.jp/contests/abc146/tasks/abc146_b

N = int(input())
S = input()

tmp = ""

for s in S:
    print(ord(s))
    unicode_point = ord(s) + N

    if unicode_point > 90:
        unicode_point = 64 + (unicode_point - 90)

    tmp += chr(unicode_point)

print(tmp)
# Judge status: Accepted
a, b, c = map(int, input().split())
if a+b >= c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted

sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy

p1="U"*y+"R"*x
p2="D"*y+"L"*x
p3="L"+"U"*(y+1)+"R"*(x+1)+"D"
p4="R"+"D"*(y+1)+"L"*(x+1)+"U"

print(p1+p2+p3+p4)
# Judge status: Accepted
S = input()
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a, b, c = map(int, raw_input() .split())
if a == b and a != c or a == c and a != b or b == c and b != a:
    print 2
elif a == b == c:
    print 0
else:
    print 3
# Judge status: Accepted
n, a, b = map(int, input().split())

if (b-a) % 2 == 0:
    print((b-a)//2)
else:
    print(min(n-b, a-1) + 1 + ((b-a-1)//2))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

dp = [0] * (n + 1000)
dp[0] = 1000

for i in range(1, n):
    for j in range(i):
        stock = dp[j] // a[j] * a[i] + dp[j] % a[j]
        dp[i] = max(dp[i - 1], stock)
print(dp[n-1])
# Judge status: Wrong Answer
N, K = map(int, input().split())

if N == K:
  print(0)
elif N > K:
  if N%K == 0:
    print(0)
  else:
    print(abs(K-N%K))
else:
  print(N)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(1, n - 1):
    if (p[i - 1] < p[i]) and (p[i] < p[i + 1]):
        cnt+=1
    elif (p[i - 1] > p[i]) and (p[i] > p[i + 1]):
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
a,b = map(int,input().split())
n=a+b
if n%2==0:print(n/2)
else:print("IMPOSSIBLE")
# Judge status: Accepted
n,m = map(int,input().split())

res = n*(n-1)//2 + m*(m-1)//2
print(res)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print(min(a//b, c))
# Judge status: Wrong Answer
import collections
N, M = map(int, input().split())

xy = [map(int, input().split()) for _ in range(M)]
x, y = [list(i) for i in zip(*xy)]
M = []


Z = x + y
Z = sorted(Z)

c = collections.Counter(Z)

V = list(c.values())

for i in range(len(V)):
    print(V[i])
# Judge status: Accepted
import heapq

n,m = map(int, input().split())
ab = [[] * (m+1) for i in range(m+1)]
for i in range(n):
  a,b = map(int, input().split())
  if m - a < 0:
    continue
  ab[a].append(b)

q=[]
ans = 0
heapq.heapify(q)
for i in range(1,m+1):
  for j in ab[i]:
    heapq.heappush(q, j*(-1))
  if q:
    b = heapq.heappop(q)
    ans += (-1) * b
print(ans)
# Judge status: Wrong Answer
s, t = input().split()
a, b = map(int, input().split())
c = input()
if c == a: a -= 1
else: b -= 1
print(a, b)
# Judge status: Wrong Answer
N,M = map(int,input().split())
#N<=Mとして一般性を失わない
N = min(N,M)
M = max(N,M)

if N==M==1:
    print(1)
if N==1 and M>=2:
    print(M-2)
if N==2 and M>=2:
    print(0)
if N>=3 and M>=3:
    print((N-2)*(M-2))
# Judge status: Accepted
s = input()
L = []
i = 0
pre = ''
while i < len(s):
    c = s[i]
    if c == pre:
        if i == len(s) - 1:
            break
        c += s[i+1]
        i += 1
    L.append(c)
    pre = c
    i += 1
print(len(L))
# Judge status: Wrong Answer
n  = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    a[i] = abs(a[i])
    ans += a[i]
if 0 in a:
    print(ans)
else:
    print(ans - 2*min(a))
# Judge status: Wrong Answer
import sys
n = int(input())
b = list(map(int,input().split()))
if n == 2:
    print(b[0]*2)
    sys.exit()
if n == 3:
    print(b[0]*2+b[1])
    sys.exit()
sum = b[0]+b[n-2]
for i in range(n-2,1,-1):
    if b[i] >= b[i-1]:
        sum += b[i-1]
    else:
        sum += b[i]

print(sum)
# Judge status: Accepted
input_line=list(map(int, input().split()))
for i in range(len(input_line)):
    if input_line[i]==0:
        print(i+1)
# Judge status: Accepted
a,b = map(int,input().split())
Flag = "Impossible"
if a%3==0:
  Flag = "Possible"
elif b%3 ==0:
  Flag="Possible"
elif (a+b)%3==0:
  Flag = "Possible"
  
print(Flag)
# Judge status: Wrong Answer
# input
H = int(input())

M = [H]
cnt = 0
while [1] * len(M) == M:
    for idx, m in [(idx, m) for idx, m in enumerate(M) if m > 1]:
        del M[idx]
        M += [m // 2, m // 2]
        cnt += 1

print(cnt + len(M))
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))

total = sum(A)
print(max(-1, N - total))
# Judge status: Accepted
a,b = map(int,input().split())
r = b-a
ans = 0
for i in range(r):
    ans += i

print(ans - a)
# Judge status: Accepted
def main():

    A, B, M = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ans = min(a) + min(b)
    for _ in range(M):
        x, y, c = map(int, input().split())
        ans = min(ans, a[x-1] + b[y-1] - c)
    return ans

if __name__ == '__main__':
    print(main())
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
edges = 2
cnt = 1
ans = 1
for i in range(N-1):
    if A[i] == A[i+1]:
        cnt += 1
        continue
    if cnt >= 2:
        edges -= 1
        ans *= A[i]
    if edges == 0:
        break
    cnt = 1
if edges != 0 and cnt >= 2:
    edges -= 1
    ans *= A[N-1]
if edges == 0:
    print(ans)
else:
    print(0)
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = input()

cnt = 0
blue = 0
red = 0

for i in range(1, n):
	if s[i] == s[i-1]:
		cnt += 1
	elif s[i-1:i+1] == 'LR':
		blue += 1
	elif s[i-1:i+1] == 'RL':
		red += 1

if k <= min(blue, red):
	cnt += 2 * k
else:
	cnt += min(blue, red)
	if s[0] == 'L' and s[-1] == 'R':
		cnt += 1

print(cnt)
# Judge status: Accepted
a,b = map(int, input().split())
print(a*b if a<10 and b<10 else -1)
# Judge status: Accepted
# ABC 066 B
S =input()

m = 0
for i,s in enumerate(S):
    tmp = S[:-1-i]
    tmp1 = tmp[:len(tmp)//2]
    tmp2 = tmp[len(tmp)//2:]
    if len(tmp)%2==0 and(tmp1==tmp2):
        m = max(m,len(tmp))
print(m)
# Judge status: Accepted
K = int(input())
S = input()

if K >= len(S):
    print(S)
else:
    S = S[0:K]
    print(S + "...")
# Judge status: Accepted
A,B = map(int,input().split())
for i in range(20):
  if 1+(A-1)*i>=B:
    print(i)
    exit()
# Judge status: Accepted
x = int(input())
print([360*n//x for n in range(1, 500) if 360 * n % x == 0][0])
# Judge status: Accepted
W,H,N = map(int, input().split())
bottom = [0, 0]
top = [W,H]

for _ in range(N):
    x,y,a = map(int, input().split())
    if a==1:
        bottom[0] = max(bottom[0], x)
    elif a==2:
        top[0] = min(top[0], x)
    elif a==3:
        bottom[1] = max(bottom[1], y)
    elif a==4:
        top[1] = min(top[1], y)

print(max(0, top[0]-bottom[0])*max(0,top[1]-bottom[1]))
# Judge status: Wrong Answer
n = 5
s = input()
 
a = s[int(n/2):]
b = s[:int(n/2)]
 
if a==b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s=input()
n=len(s)
k=int(input())

index=-1
for i in range(n):
    if s[i]!='1':
        index=i
        break

if index==-1:
    print(1)
else:
    if k<=index:
        print(s[k-1])
    else:
        print(s[index])
# Judge status: Accepted
import sys
input=sys.stdin.readline

s=input()


if 0<int(s[:2])<13:
	upper=True
else:
	upper=False

if 0<int(s[2:])<13:
	low=True
else:
	low=False

if upper and low:
	print("AMBIGUOUS")

elif not upper and low:
	print("YYMM")

elif upper and not low:
	print("MMYY")
else:
	print("NA")
# Judge status: Accepted
n,m=map(int,input().split())
n_pict=[]
m_pict=[]
for _ in range(n):
  n_pict.append(input())
for _ in range(m):
  m_pict.append(input())
  
for y in range(n-m+1):
  for x in range(n-m+1):
    found=True
    for a in range(m):
      if m_pict[a]!=n_pict[y+a][x:x+m]:
        found=False
        break
    if found:
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
L, R, d = map(int, input().split())
result = [i for i in range(L, R+1) if i % d == 0]
print(len(result))
# Judge status: Accepted
s = input()
n = len(s)
s1 = []
s2 = []
for i in range(n):
    if i % 2 == 0:
        s1.append("0")
    else: s1.append("1")
for i in range(n):
    if i % 2 != 0:
        s2.append("0")
    else: s2.append("1")
s1_switch = 0
s2_switch = 0
for i in range(n):
    if s[i] != s1[i]:
        s1_switch += 1
    elif s[i] != s2[i]:
        s2_switch += 1
print(min(s1_switch, s2_switch))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
cnt = 0
for i in range(n):
    if p[i] != i+1:
        cnt += 1
if cnt == 0 or cnt == 2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = list(map(int,input().split()))
    x = sum(a)/N - sum(a)//N
    if  0 <= x < 0.5:
        ch = sum(a)//N
    else:
        ch = -(-sum(a)//N)
        
    ans = 0
    for i in range(N):
        ans += (ch-a[i]) ** 2
        
    print(ans)
        
if __name__ == "__main__":
    main()
# Judge status: Accepted
#055_B
N=int(input())
import math
print(math.factorial(N)%(10**9+7))
# Judge status: Accepted
import numpy as np
N = int(input())
C = [6 ** x for x in range(8) if 6 ** x <= N]
C += [9 ** x for x in range(8) if 9 ** x <= N]

dp = np.zeros(N + 1, np.int64)
dp += 10 ** 10

for c in C:
    dp[c] = 1
for c in C:
    for _ in range(9):
        dp[c:] = np.minimum(dp[c:], dp[:-c] + 1)
print(dp[N])
# Judge status: Accepted
a, b, c, d = list(map(int, input().split()))
print(max(a*c, b*c, a*d, b*d))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))

mini=float("inf")
summ=0
for i in range(N):
  mini = min(mini,abs(A[i]))
  summ += abs(A[i])
  
print(summ-2*mini)
# Judge status: Wrong Answer
num = input()
x,y,z = num.split(" ")
if x == y or y == z or x == z:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    x, y = MII()
    print(x+y//2)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import heapq

N, M=map(int, input().split())
AB=[list(map(int, input().split())) for i in range(N)]
AB=sorted(AB, key=lambda x:x[0])
h=[0]*M
heapq.heapify(h)

out=0
j=0
for i in range(1, M+1):
  while j<N and AB[j][0]<=i:
    heapq.heappush(h, -1*AB[j][1])
    j+=1
    
  out+=-1*heapq.heappop(h)
  
print(out)
# Judge status: Accepted
N = int(input())
if N%2 == 1:
    print(0)

else:
    ans = 0
    tmp = 10
    while N >= tmp:
        ans += N // tmp
        tmp *= 5

    print(ans)
# Judge status: Accepted
import math
n=int(input())
ans=math.pi*2*n
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if 0<=c-a<=b:print("YES")
else:print("NO")
# Judge status: Wrong Answer
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer
import sys
import math
#ta,ao= map(int,input().split())
li = [int(x) for x in input().split()]
if li.count(3)==0:
  print(3)
elif li.count(2)==0:
  print(2)
else:
  print(1)
# Judge status: Accepted
def main():
    s = input()
    t = input()

    print([s[i] == t[i] for i in range(len(s))].count(False))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
X = int(input())
n = math.ceil((math.sqrt(1 + 8 * X) - 1)/2)
print(n)
# Judge status: Wrong Answer
def mul():
    s = raw_input()

    a,b = s.split(' ')
    a,b = int(a),int(b)

    if a <= 9 and a >=1 and (1 <= b <= 9):
        return a * b
    else:
        return -1
# Judge status: Wrong Answer
n = int(input())
a =  list(map(int,input().split()))
list_num = len(a)
kl = 0
kr = 1
while kl < len(a):
  if a[kl] != kr:
    try:
      del a[kl:a.index(kr)]
    except:
      print(-1)
      exit()
  kl += 1
  kr += 1


print(list_num-len(a))
# Judge status: Accepted
a, b, c = map(int, input().split())

if b-a == c-b:
  print('YES')
  
else:
  print('NO')
# Judge status: Accepted
import math


def main():
    n = int(input())
    sum = (n-1)*2-1
    for i in range(2, n):
        sho = n // i
        amari = n % i
        if i**2 >= n:
            break
        if amari == 0:
            sho -= 1
        sum += (sho - i+1) * 2 - 1
    print(sum)


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

if a>=b:
  print(str(b*a))
elif b>=a:
  print(str(a*b))
# Judge status: Wrong Answer
a,b = map(int, input().split())
tmp = []
for i in range(a):
  tmp.append(b+i)
if b < 0 and a <= abs(b):
  tmp = tmp[:-1]
elif b >= 0:
  tmp = tmp[1:]
print(tmp)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
all = 0
for a in A:
    all ^= a

ans = ""

for a in A:
    ans += str(a^all) + " "

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

a = A//K
b = B//K
c = A%K
d = B%K

if a == b:
    if c == 0 or d == 0:
        print('OK')
    else:
        print('NG')
else:
    print('OK')
# Judge status: Accepted
# -*- coding: utf-8 -*-
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    ans = s[:k] + '...'
    print(ans)
# Judge status: Accepted
N = int(input())
INF = 10**18
dp = [INF] * (N+1)
dp[0] = 0

for i in range(1, N+1):
    dp[i] = min(dp[i], dp[i-1]+1)
    p = 6
    while p <= i:
        dp[i] = min(dp[i], dp[i-p]+1)
        p *= 6
    p = 9
    while p <= i:
        dp[i] = min(dp[i], dp[i-p]+1)
        p *= 9
print(dp[N])
# Judge status: Wrong Answer
s = input()

sl = [int(s[i]) for i in range(len(s))]
ans1 = [i%2 for i in range(len(s))]
ans2 = [i%2+1 for i in range(len(s))]

diff1, diff2 = 0, 0
for i in range(len(sl)):
    if sl[i] != ans1[i]:
        diff1 += 1
    if sl[i] != ans2[i]:
        diff2 += 1

print(min(diff1, diff2))