peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from collections import defaultdict
import string
import sys
sys.setrecursionlimit(10 ** 7)
from functools import lru_cache

N = int(input())
alph = string.ascii_lowercase

def search(S, mx):
    if len(S) == N:
        print(S)
    else:
        for s in alph[: mx + 1]:
            search(S + s, mx)
        search(S + alph[mx + 1], mx + 1)

search('a', 0)
# Judge status: Accepted

[a,b,c,d] = list(map(int,input().split()))

dam=[]
dam.append(a*c)
dam.append(a*d)
dam.append(b*c)
dam.append(b*d)
print(max(dam))
# Judge status: Accepted
turn = "A"
A, B, C, D = map(int, input().split(' '))

while A > 0 and B > 0:
    if turn == "A":
        C -= B
        turn = "C"
        if not C > 0:
            print('Yes')
            break
    else:
        A -= D
        turn = "A"
        if not A > 0:
            print('No')
            break
# Judge status: Wrong Answer
s = input()
count = 0
for i in range(len(s)):
  if s[len(s) - i - 1] == 'T':
    break
  count += 1
print(count * 2)
# Judge status: Accepted
s = input()

for i in range(len(s)):
    print("x", end="")
# Judge status: Accepted
n,x,y=map(int,input().split())
x,y=x-1,y-1

ans=[0]*(n+1)



for i in range(n):
    for j in range(i+1,n):
        a=abs(i-j)
        b=abs(i-x)+1+abs(y-j)
        c=abs(y-i)+1+abs(x-j)
        ans[min(a,b,c)]+=1
for i in range(1,n):
    print(ans[i])
# Judge status: Accepted
N = int(input())
S = input()
ans = ''
count = 0
for i in range(N):
    if S[i] == '(':
        count += 1
    else:
        count -= 1
    if count < 0:
        ans = '(' + ans
        count += 1
    ans += S[i]
if count > 0:
    ans += ')' * count
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())

if a*b %2 == 0:
    print("Even")
else:
    print("Odd")
# Judge status: Wrong Answer
a,b=map(int,input().split())
i=a+b/2
print(a)
print(b)
print(i)
if i.is_integer()==True:
    print(i)
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
n = int(input())
lis = list(map(int, input().split()))

cnt1 = 0
cnt2 = 0
cnt4 = 0
for i in lis:
    if i % 4 == 0:
        cnt4 += 1
    elif i % 2 == 0:
        cnt2 += 1
    else:
        cnt1 += 1

if cnt1 - cnt4 > 1:
    print("No")
elif cnt1 - cnt4 == 1:
    if cnt2 == 0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
# Judge status: Accepted
X,Y = list(map(int,input().split()))
if X%Y == 0:
    print(-1)
else:
    print(X)
# Judge status: Accepted
# 最大公約数
def gcd(a,b):
    while b != 0:
        a,b = b, a%b
    return a

n,x = map(int,input().split())
X = list(map(int, input().split()))
a = []
dist = []
if len(X) == 1:
    print(abs(X[0]-x))
    exit()
for i in range(len(X)):
    a.append(abs(X[i]-x))
ans = 0
for d in a:
    ans = gcd(ans,d)
print(ans)
# Judge status: Wrong Answer
s = input()
if s == "SUN":
  print(7)
if s == "SAT":
  print(6)
if s == "FRI":
  print(5)
if s == "THU":
  print(4)
if s == "WED":
  print(3)
if s == "TUE":
  print(2)
if s == "MON":
  print(1)
# Judge status: Accepted
#abc177_B_1
list_1 = list(str(input()))
list_2 = list(str(input()))

int_agg_count_max_diff = 10000
for i in range(len(list_1) - len(list_2) + 1):
  list_1_tmp = list_1[i:i+len(list_2)]
  
  int_count_max_diff = 0
  for j in range(len(list_2)):
    if list_1_tmp[j] != list_2[j]:
      int_count_max_diff = int_count_max_diff + 1
  if int_agg_count_max_diff > int_count_max_diff:
    int_agg_count_max_diff = int_count_max_diff
print(int_agg_count_max_diff)
# Judge status: Accepted
from collections import Counter
n = int(input())
s = list(input())
C = Counter(s)
p = 1
for v in C.values():
    p = p * (v+1) % (10**9 +7)

print(p-1)
# Judge status: Accepted
n = input()
int_n = int(n)
# 解説通り

ans = int(n[0]) + 9 * (len(n) - 1)

for i in range(1, len(n)):
    if n[i] != '9':
        ans -= 1
        break
print(ans)
# Judge status: Wrong Answer
n = int(input())
a =[int(i)  for i in input().split()]
b = sum(a) // 2
c = 0
for i in range(n):
    c += a[i]
    if c > b:
        d = i
        break

e = abs(sum(a[:d+1]) - sum(a[d+1:]))
f = abs(sum(a[:d]) - sum(a[d:]))

if e > f:
    ans = f
else:
    ans = e
if n == 2:
    ans = e
print(ans)
# Judge status: Wrong Answer
N,M = map(int, input().split())
a_list = [int(input()) for _ in range(M)]

MOD = 10**9+7

dp = [0] * (10**5 + 3)
dp[1] = 0
dp[2] = 1
dp[3] = 2
for i in range(3, len(dp)):
    dp[i] = dp[i-1] + dp[i-2] 

res = 1
if M > 0:
    bef = -1
    for a in a_list:
        res *= dp[a-bef]
        res %= MOD
        bef = a
else:
    bef = 0
res *= dp[N-bef+1]
res %= MOD

print(res)
# Judge status: Accepted
s=input()
c=0
for n,r in zip(s[:len(s)//2],s[::-1]):
    if not n==r:
        c+=1
print(c)
# Judge status: Accepted
s = input()
cnt = 0
for i in range(len(s)//2):
	if s[i] != s[i*(-1)-1]:
		cnt += 1
print (cnt)
# Judge status: Accepted
N = int(input())
A = [list(map(int,input().split())) for i in range(2)]

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

for i in range(N-2,-1,-1):
    A[1][i]=A[1][i]+A[1][i+1]

for i in range(N):
    A[0][i]+=A[1][i]

print(max(A[0]))
# Judge status: Accepted
n = int(input())
s = [int(si == "E") for si in input()]
a = [0] * (n + 1)
for i in range(n):
  a[i + 1] = a[i] + s[i]
ans = n
for i in range(n):
  ans = min(a[-1] - a[i + 1] + i - a[i], ans)
print(ans)
# Judge status: Wrong Answer
import numpy as np
n = int(input())

ans = np.zeros(n+1)
for i in range(1, n+1):
  ans[i::i] += 1

ans *= np.arange(n+1)
# [0, f(1), ..., f(n)] * [0, 1, 2, ..., n]
print(sum(ans))
# Judge status: Accepted
x=int(input())
print(0 if x==1 else 1)
# Judge status: Accepted
n,a,b=map(int,input().split())
c=min(a,b)
d=max(a,b)
e=min(2*n-a-b,a+b-2)
f=min(c-1,n-d)
if d-c==1:
  print(f+1)
elif (d-c)%2==0:
  print((d-c)//2)
else:
  print((e+1)//2)
# Judge status: Accepted
n,m = map(int, input().split())
a = sorted(list(map(int ,input().split())))
d = []
for i in range(m-1):
  d += [a[i+1] - a[i]]
d.sort(reverse=True)
print(sum(d[n-1:]))
# Judge status: Wrong Answer
S=input()

ans="NO"
tate=False
yoko=False

n=S.count("N")
w=S.count("W")
s=S.count("S")
e=S.count("E")

if (n>0 and s>0) or (n==0 and s==0):
  tate=True
if (e>0 and w>0) or (e==0 and w==0):
  yoko=True
  
if tate and yoko:
  ans="Yes"
  
print(ans)
# Judge status: Accepted
a = int(input())
a += int(input())
a *= int(input())
print(a//2)
# Judge status: Accepted
s=input()
ans= 1000
for i in range(len(s)-2):
    tmp=int(s[i:i+3])
    ans=min(ans, abs(tmp-753))
print(ans)
# Judge status: Accepted
s = input()

f = False
sl = len(s)
while f == False:
    sl -= 2
    if s[0:sl//2] == s[(sl+1)//2:sl]:
        f = True

print(sl)
# Judge status: Wrong Answer
N = int(input())
H = [int(x) for x in input().split()]

for i in range(N-1):
    if H[i] - H[i+1] == 1:
        H[i] -= 1
flg=True
for i in range(N-1):
    if H[i] - H[i+1] == 1:
        flg=False
        break
ans = 'Yes' if flg else 'No'
print(ans)
# Judge status: Accepted
N, K = map(int, input().strip().split())

A = list(map(int, input().strip().split()))

minlen = 0
maxlen = 10**9

while maxlen-minlen > 1:
  mid = (maxlen + minlen)//2
  if mid == 0:
    cur = 1e9
  else:
  	cur = sum((a+mid-1)//mid - 1 for a in A)
  
  if cur > K:
    minlen = mid
  else:
    maxlen = mid

print(maxlen)
# Judge status: Accepted
import sys

S = input()
for i in range(len(S) + 1):
    for j in range(i, len(S) + 1):
        erased = S[:i] + S[j:]
        # print(i, j, erased)
        if erased == "keyence":
            print("YES")
            sys.exit()
print("NO")
# Judge status: Wrong Answer
#coding: utf-8
N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(N-1, -1, -1):
    v = 0
    for j in range(2*i-1, N, i+1):
        if A[i] == 1:
            v += 1
    if A[i] == 1 and v % 2 == 0:
        B.append(i+1)
    elif A[i] == 0 and v % 2 == 1:
        B.append(i+1)
B.sort()
print(len(B))
if len(B) != 0:
    print(*B)
# Judge status: Accepted
n,d=map(int,input().split())

ans=n//((2*d)+1)

if n%((2*d)+1)==0:
  print(ans)
else:
  print(ans+1)
# Judge status: Accepted
import math 

n = int(input())

print(math.ceil(n/2))
# Judge status: Wrong Answer
n, *lst = map(int, open(0).read().split())
if n < 3:
  print(0)
  quit()
group = 0
start = lst[1] >= lst[0]
for i in range(2, n - 1):
  if (lst[i] >= lst[i - 1]) != start:
    start = (lst[i + 1] > lst[i])
    group += 1
if (lst[-1] >= lst[-2]) != start:
  group += 1
if group != 0:
  group += 1
print(group)
# 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
N,L=map(int,input().split())
v=[L+i for i in range(N)]
ans=sum(v)-min(v,key=abs)
print(ans)
# Judge status: Accepted
a, b, c = sorted(list(map(int, input().split())))

if c == a + b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = list(input().split())
for i in a:
    print(i[0],end="")
# Judge status: Accepted
n, k = map(int, input().split())
hp_list = list(map(int, input().split()))
hp_list.sort()

attack = 0
for i, hp in enumerate(reversed(hp_list)):
  if i < k:
    continue
  attack += hp
print(attack)
# Judge status: Accepted
N = int(input())
C = input()

cnt =  0
R = C.count('R')

for i in range(R):
    if C[i] == 'R':
        cnt += 1
print(R - cnt)
# Judge status: Accepted
n=input()
m=len(n)
n=int(n)
ans=0
for i in range(m//2):
  ans+=9*10**(2*i)
if m%2==1:
  ans+=n+1-10**(m-1)
print(ans)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += 1
print(ans)
# Judge status: Accepted
x,y=list(map(int, input().split()))

if x==1 or y==1:
	if x==1 and y==1:
		print(1)
	else:
		print(x*y-2)

else:
	print(((x-2)*(y-2)))
# Judge status: Wrong Answer
n=int(input())
s=str(input())

result=""

for i in s:
    result += chr(ord(i)+n)

print(result)
# Judge status: Accepted
n=input()
b = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in range(0, len(a)):
  ans += min(a[i], b[i])
  rem = a[i] - b[i]
  # print(rem)
  temp = max(0, min(rem, b[i + 1]))
  ans += temp
  b[i + 1] -= temp
print(ans)
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
ans = b[0]
for i in range(1,n-1):
    ans += min(b[i-1],b[i])
print(ans+b[-1])
# Judge status: Accepted
import sys
input=sys.stdin.readline
n=int(input())
button=[False]*(n+1)
button[1]=True
a={}
for i in range(1,n+1):
    ai=int(input())
    a[i]=ai
tmp=1
pushed={}
ans=0
while not button[2]:
    button[tmp]=False
    if tmp in pushed:
        print(-1)
        exit()
    pushed[tmp]=1
    tmp=a[tmp]
    button[tmp]=True
    ans+=1
print(ans)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    k = int(input())
    s = input().strip()
    if len(s) > k:
        print(s[:k] + '...')
    else:
        print(s)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
n=len([i for i in range(c) if i%a==0])
print(b*n)
# Judge status: Accepted
def solve():
    N, M = [int(i) for i in input().split()]
    R = [[] for _ in range(N)]
    for _ in range(M):
        a, b = [int(i) for i in input().split()]
        R[a - 1].append(b)
        R[b - 1].append(a)
    for r in R:
        print(len(r))

if __name__ == "__main__":
    solve()
# Judge status: Accepted
import heapq

def solve():
    N = int(input())
    A = list(sorted(map(int, input().split()), reverse=True))
    C = [-A[0]]

    ans = 0
    for a in A[1:]:
        K = heapq.heappop(C)
        ans += -K
        heapq.heappush(C, -a)
        heapq.heappush(C, -a)

    print(ans)



solve()
# Judge status: Accepted
N = int(input())
D = [input() for j in range(N)]
S = list(set(D))
print(len(S))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import *

s = input()[:-1]
l = []
cnt = 1
    
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        l.append((s[i], cnt))
        cnt = 1
    else:
        cnt += 1
    
l.append((s[-1], cnt))
ans = 0

for si, c in l:
    if si=='R':
        ans = max(ans, c)

print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
#S=N,C=M
print(((2*N)+M)//4)
# Judge status: Wrong Answer
n, l = map(int, input().split())
a = []
if n == 1:
  print(input())
  exit()
for i in range(n):
  a.append(input())
a.sort()
print(a[0])
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
h[0] -= 1
for i in range(1, n):
    if h[i]-h[i-1] < 0:
        print('No')
        exit()
    if h[i] - h[i-1] > 0:
        h[i] -= 1
print('Yes')
# Judge status: Accepted
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))


def run():
    a, b, x = input_int_map()
    result = count_num(b, x) - count_num(a - 1, x)
    print(result)

def count_num(num, x):

    if num < 0:
        return 0

    return num // x + 1

run()

# 2 4 3

# 3 4 3

# 2 6 3
# Judge status: Accepted
x=int(input())

num = x//100
div = x%100
ans=0

if  0<=div<=(num*5):
    ans=1

print(ans)
# Judge status: Accepted
input()
s = input()
ans = ''
cnt_l = 0
cnt_r = 0
cur = 0
for c in s:
    if c == '(':
        if cur < 0:
            cnt_l += abs(cur)
            cur = 0
        cur += 1
    else:
        cur -= 1
if cur > 0:
    cnt_r += cur
else:
    cnt_l += abs(cur)
print(cnt_l*'(' + s + cnt_r*')')
# Judge status: Accepted
n, k = map(int,input().split())
s = list(input())

if s[k-1] == "A":
    s[k-1] = "a"
if s[k-1] == "B":
    s[k-1] = "b"
if s[k-1] == "C":
     s[k-1] = "c"
print("".join(s))
# Judge status: Accepted
x,y= map(int, input().split())
a=min(x,y)
b=max(x,y)
mod=pow(10,9)+7
if b-a>a or (a-(b-a))%3!=0:
    print(0)

else:
    r=(a-(b-a))//3
    l=((a-(b-a))//3)+(b-a)
    c=1
    d=1
    for i in range(r):
        c=(c*(l+r-i))%mod
        d=(d*(r-i))%mod
    ans=c*pow(d,mod-2,mod)
    print(ans%mod)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
c = 0
for x in range(1, n+1):
	if x & 1 and a[x-1] & 1:
		c += 1
print(c)
# Judge status: Wrong Answer
N = str(input())
ans = 0
if len(N) <= 98:
    ans += 1
for i in range(len(N)):
    ans += min(10-int(N[i]), int(N[i]))
print(ans)
# Judge status: Accepted
x=int(input())
t=0
p=0
while p<x:
    t+=1
    p+=t
print(t)
# Judge status: Wrong Answer
n, d = map(int, input().split())

num = -( -n // (2*d) )

print(num)
# Judge status: Accepted
n = int(input())
s = [input() for i in range(n)]
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

# [[1, 1], [0, 1], [0, 0], [1, 0]]
dic = {}

for i in range(n):
    sen = '・'.join(sorted(s[i]))
    #print(sen)
    if sen not in dic:
        dic[sen]=1
    else:
        dic[sen]+=1    
#print(dic)
ans = 0
for i in dic.values():
    ans += i*(i-1)//2
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
x = [0]*(n+1)
m = 0
ans = []
for i in reversed(range(1,n+1)):
  tmp = 0
  for j in range(2*i,n+1,i):
    if x[j] == 1:
      tmp += 1
  if tmp % 2 != a[i-1]:
    x[i] = 1
    m += 1
    ans.append(i)
print(m)
for i in ans:
  print(i,end=" ") 
"""
#no ball
if all(i == 0 for i in x):
  print(0)
  exit()
#else
for i in range(1,n+1):
  if x[i] == 1:
    print(i,end=" ")
"""
# Judge status: Wrong Answer
n=int(input())
ans=n
for i in range(1,n):
    a=str(i*10000)
    b=int(a[0])+int(a[1])+int(a[2])+int(a[3])
    c=str((n-i)*10000)
    d=int(c[0])+int(c[1])+int(c[2])+int(c[3])
    ans=min(ans,b+d)
print(ans)
# Judge status: Accepted
n,x=map(int,input().split())
l=list(map(int,input().split()))
length=0
i=0
while length<=x and i<=n-1:
    length+=l[i]
    i+=1
if length<=x:
    print(n+1)
else:
    print(i)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import numpy as np

X = int(input())

a=0
if X==2 or X==3:
  a=1
while a<1:
  for i in range(2,int(np.sqrt(X))+1):
    a=1
    if X%i==0:#素数でない
      a=0
      break
    else:#素数かも
      pass
  if a==0:
    X+=1
print(X)
# Judge status: Accepted
import math
h, a = list(map(int, input().split()))

print(math.ceil(h/a))
# Judge status: Accepted
a,b=map(int,input().split())
s=input()
if s[0:a].isdigit() and s[a+1:].isdigit() and s[a] == "-":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))

ps = sorted(p)

cnt = 0
for i in range(len(p)):
  if p[i] != ps[i] :
    cnt += 1
    if cnt > 2 :
      print("NO")
      exit()

print("YES")
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * n - i) % m
    val2 = (val2 * i + 1) % m
ans -= (val * (pow(val2, m-2, m)))
val = 1
val2 = 1
for i in range(b):
    val *= (n - i) % m
    val2 *= (i + 1) % m
ans -= (val * (pow(val2, m-2, m)))
print(ans % (int(1e9) + 7))
# Judge status: Accepted
N, M, K =map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))


a = [0]
b = [0]

for i in range(N):
    a.append(a[i] + A[i])
for j in range(M):
    b.append(b[j] + B[j])

ans = 0
j = M

for i in range(N+1):
    if a[i] > K:
        break
    while a[i] + b[j] > K:
        j -= 1
    ans = max(ans, i+j)
    
            
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(int(a) for a in input().split())

print(((N-1)+(K-2))//(K-1))
# Judge status: Wrong Answer
s = list(input())
if "A" in s and not("B" in s):
  print("No")
elif "B" in s and not("A" in s):
  print("NO")
else:
  print("Yes")
# Judge status: Wrong Answer
ll, rr = map(int, input().split())
if rr - ll >= 2019:
    print(0)
    exit()

l = ll % 2019
r = rr % 2019

if l > r:
    print(0)
    exit()
print(l,r)
ans = 10**9
for i in range(l, r + 1):
    for j in range(i+1, r+1):
        x = (i * j) % 2019
        print(x)
        ans = min(x, ans)

print(ans)
# Judge status: Accepted
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
q=[-a[i] for i in range(n)]
heapq.heapify(q)
for _ in range(m):
  x=heapq.heappop(q)
  x=(x+1)//2
  heapq.heappush(q,x)
ans=0
for _ in range(n):
  ans-=heapq.heappop(q)
print(ans)
# Judge status: Wrong Answer
# ABC140C

n = int(input()) - 1
b = list(map(int, input().split()))

max_value = b[0] + b[n - 1]
for i in range(n - 1):
    max_value += min(b[i], b[i + 1])
# Judge status: Accepted
inputList = input().split()

s = int(inputList[0])
w = int(inputList[1])

if s <= w:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
n = int(input())
numbers = [int(x) for x in input().split()]
flag = 'APPROVED'
for number in numbers:
  if number % 3 == 0 or number % 5 == 0:
    continue
  else:
    flag = 'DENIED'
    break
print(flag)
# Judge status: Accepted
import math
n = int(input())
x = math.floor(math.sqrt(n))
ans = 0
for m in range(1,x+1):
    ans += m*(m+math.floor(n/m))*(math.floor(n/m)+1-m)
print(int(ans-(((x+1)**4-x**4)-((x+1)**2-x**2))/12))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X, Y = map(int, rl().split())
    
    for i in range(X + 1):
        if 2 * i + 4 * (X - i) == Y:
            print('Yes')
            return
    print('No')


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
X = list(input())

for i in range(2**3):
    W = ["+"]*3
    for j in range(3):
        if (i >> j) & 1:
            W[j] = "-"
    formula = ""
    for k,l in zip(X,W+[""]):
        formula += k+l
    if eval(formula) == 7:
        print(formula+"=7")
        break
# Judge status: Wrong Answer
import math

r = int(input())

a = math.pi * r**2

print(a)
# Judge status: Accepted
X,A,B=map(int,input().split())
eat=-A+B
if int(eat)<=0:
  print("delicious")
elif int(eat)<=X:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
H,W=map(int,input().split())
if W==1 or H==1:
	print(1)
elif H%2==0 and W%2==0:
	print((H//2)*(W))
elif H%2==1 and W%2==0:
	print(H*W-((H//2)*(W//2))-((H//2)+1)*(W//2))
elif H%2==0 and W%2==1:
	print(H*W-((W//2)*(H//2))-((W//2)+1)*(H//2))
else:
	print(H*W-((H//2)*((W//2)+1))-((H//2)+1)*(W//2))
# Judge status: Accepted
n, x, y = map(int,input().split())

cnt = [0] * (n - 1)
for i in range(1, n):
    for j in range(i + 1, n + 1):
        temp1 = j - i
        temp2 = abs(i - x) + abs(j - y) + 1
        dis = min(temp1, temp2)
        cnt[dis - 1] += 1

print(*cnt, sep='\n')
# Judge status: Wrong Answer
#https://atcoder.jp/contests/abc153/tasks/abc153_c
N,K =map(int,input().split())
M_List = sorted(list(map(int,input().split())))
if N<=K:
    print(0)
else:
    print(sum(M_List[:K*(-1)]))
# Judge status: Accepted
def gcd(a, b):
    if (a == 0):
        return b
    return gcd(b%a, a)

def lcm(a, b):
    return (a*b)//gcd(a, b)
    
n = int(input())

numbers = list(map(int, input().split()))

l = numbers[0]
for i in range(1, n):
    l = lcm(l, numbers[i])

ans = 0

for i in range(n):
    ans += l//numbers[i]

MOD = 1000000007
print(ans%MOD)
# Judge status: Wrong Answer
import sys
X=input()
N=int(X)

for i in range(1,9):
    a=N//i
    b=N%i
    if (0<a<10 and b==0):
        print("Yes")
        break
else:
     print("No")
# Judge status: Accepted
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab = sorted(ab, key=lambda ab:ab[0])

ans = 0
total = 0
for i in range(n):
  num = m - total
  if ab[i][1]<num:
    total += ab[i][1]
    ans += ab[i][0]*ab[i][1]
  else:
    total += num
    ans += num*ab[i][0]
    break
print(ans)
# Judge status: Wrong Answer
def main():
    from math import ceil
    from itertools import accumulate
    from bisect import bisect_left
    n, h, *ab = map(int, open(0).read().split())
    l = sorted(ab[1::2], reverse=True)
    x = list(accumulate(l))
    if x[-1] <= h:
        print(ceil((h - x[-1]) / max(ab[::2])) + n)
    else:
        i = bisect_left(x, h)
        print(i + 1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
r = int(input())

print(int(r**2))
# Judge status: Accepted
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
l=list(mi())
dp=[0,abs(l[0]-l[1])]
for i in range(2,a):
  dp.append(min(abs(l[i]-l[i-1])+dp[i-1],abs(l[i]-l[i-2])+dp[i-2]))
print(dp[-1])
# Judge status: Accepted
# A - Dividing a String
import sys
input = sys.stdin.readline
S = input().strip()
ans, prev, cur = 0, "", ""
for s in S:
  cur += s 
  if cur != prev: # True になるまで、curに文字列を追加していく
    ans += 1
    prev, cur = cur, ""

print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
c=0
for i in range(n):
    c+=a[i]%2
    if a[i]%2==1:
        b[i]+=i+1
print(sum(b))
print(b)
# Judge status: Accepted
# import math
# import statistics
#a=input()
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
e1,e2,e3 ,e4= map(int,input().split())
#K = input()
# f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

if e4%2==0 or e4==0:
    print(e1-e2)
elif e4%2==1 :
    print(-(e1-e2))
elif abs(e1-e2)>=10**18:
    print("Unfair")
# Judge status: Accepted

N = int(input())
L = [int(a) for a in input().split()]
count = 0

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if(L[i]+L[j]>L[k] and L[j]+L[k]>L[i] and L[k]+L[i]>L[j] and L[i]!=L[j] and L[j]!=L[k] and L[k]!=L[i]):
                count += 1

print(count)
# Judge status: Accepted
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

ans = [0 for _ in range(N)]
for i, j in ab:
    ans[i-1] += 1
    ans[j-1] += 1

for i in ans:
    print(i)
# Judge status: Accepted
import itertools
import fractions
def main():
  n = int(input())
  print(n//2 + n%2)
  
if __name__ == '__main__':
  main()