peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
w,h,x,y = map(int, input().split())
ans = 0
if w%2==0:ans += 1
if h%2==0:ans += 1
if ans > 0: ans -= 1
print((w*h)/2, ans)
# Judge status: Accepted
n = int(input())
s = input()

cnt = 0
ans = 0
for i in s:
    if i == 'I':
        cnt += 1
    else:
        cnt -= 1
    ans = max(ans, cnt)
print(ans)
# Judge status: Wrong Answer
N,L = list(map(int,input().split()))
taste = list(range(L,L+N))

m = max(taste)
for e in taste:
  if abs(e) < m:
    m = e
print(sum(taste) - m)
# Judge status: Accepted
from collections import defaultdict as dd
s=input()
t=input()
ds=dd(int)
dt=dd(int)
for ss in s:
    ds[ss]+=1
for tt in t:
    dt[tt]+=1
# print(ds)
# print(dt)
ls,lt=[],[]
for k,v in ds.items():
    ls.append(v)
for k,v in dt.items():
    lt.append(v)
# print(ls)
# print(lt)
ls.sort()
lt.sort()
for a,b in zip(ls,lt):
    if a!=b:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
sum = 0
for i in range(1,N+1):
  sum += i*len(prime_factorize(i))
print(sum)
# Judge status: Accepted
def count(list):
    dict = {}
    for i in range(len(list)):
        dict[list[i]] = dict.get(list[i], 0) + 1
    return dict

n = int(input())
a = list(map(int,input().split()))
dic = count(a)
ans = 0

for i, x in dic.items():
    differ = x - i
    if differ>0:
        ans += differ
    elif differ<0:
        ans += x

print(ans)
# Judge status: Accepted
N = int(input())
power = 1
for i in range(N):
    power*=i+1
    power%=1000000007
print(power)
# Judge status: Accepted
n,a,b = map(int, input().split())
ans = n //(a+b) * a
if n % (a+b) != 0: 
  if n % (a+b) < a: ans += n%(a+b)
  else: ans += a
print(ans)
# Judge status: Accepted
n = int(input())
ans = "No"
for i in range(n // 4 + 1):
    for j in range(n // 7 + 1):
        if 4 * i + 7 * j == n:
            ans = "Yes"
            break
print(ans)
# Judge status: Accepted
s = input()
t = input()

d = {x: 0 for x in "abcdefghijklmnopqrstuvwxyz"}
e = {x: 0 for x in "abcdefghijklmnopqrstuvwxyz"}

for i in range(len(s)):
    if d[s[i]] == 0 and e[t[i]] == 0:
        d[s[i]] = t[i]
        e[t[i]] = s[i]
    else:
        if d[s[i]] != t[i] or e[t[i]] != s[i]:
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
dp = [float("inf") for _ in range(n)]
dp[0] = 0
for i in range(1,n):
    for j in range(1,min(k,i)+1):
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])
# Judge status: Accepted
N = int(input())
print((N+1)//2)
# Judge status: Wrong Answer
N = int(input())
print(int(N*(N-1)/2))
# Judge status: Accepted
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 100100 for _ in range(110)]


for i in range(N):
    for sum_w in range(W + 1):

        if wv[i][0] <= sum_w:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])
# Judge status: Accepted
from sys import exit

n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        k = n - i - j
        if 10000 * i + 5000 * j + 1000 * k == y:
            print(i, j, k)
            exit()

print(-1, -1, -1)
# Judge status: Accepted
n = int(input())
odd_list = [num for num in range(1, n+1, 2)]
cnt_8 = 0
for i in odd_list:
    cnt = 0
    for j in range(1, i+1, 2):
        if i % j == 0:
            cnt += 1
    if cnt == 8:
        cnt_8 += 1
print(cnt_8)
# Judge status: Accepted
import math
tmp = list(map(int, input().split()))
tmp.sort()
a = tmp[0]
b = tmp[1]
c = tmp[2]

if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
    print(0)
else:

    print(abs(a * b * (c // 2) - (a * b * (math.ceil(c / 2)))))
# Judge status: Accepted
A, B, C = map(int, input().split())

if A==B==C:
    if A%2==0:
        print(-1)
    else:
        print(0)

else:
    for i in range(1000000000):
        if A %2==0 and B%2==0 and C%2==0:
            a = A/2
            b = B/2
            c = C/2
            A = b+c
            B = a+c
            C = a+b
        else:
            print(i)
            exit()
# Judge status: Accepted
a, b = map(int, input().split())
sum = 1 
count = 0
while sum < b:
  sum += a - 1
  count += 1
print(count)
# Judge status: Accepted
import re


A, B = input().split()
print('Yes') if re.fullmatch(r'[0-9]{' + A + r'}-[0-9]{' + B + r'}', input()) else print('No')
# Judge status: Accepted
A, B= input().split()
A = int(A)
B = B.replace('.','')
B = int(B)
print(A*B//100)
# Judge status: Wrong Answer
X = int(input())
DP=[0]*(X+1)

def dp(n):
  if n<100:
    return 0
  if 100<=n and n<=105:
    return 1
  res = 0
  for i in range(100,106):
    res |= DP[n-i]
  return res

for i in range(X+1):
  DP[i] = dp(i)
ans=DP[X]
print(DP)
print(ans)

#print(*ans, sep='/n')
# Judge status: Wrong Answer
x , a , b = map(int,input().split())
if abs(x-a) > abs(x-b):
    print("A")
else:
    print("B")
# Judge status: Accepted
from decimal import Decimal

a, b, c = list(map(int, input().split()))
  
if Decimal(c).sqrt() > Decimal(a).sqrt() + Decimal(b).sqrt():
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

ans = 1000000007
for i in range(1, len(a)):
  x = sum(a[0:i])
  y = sum(a[i:len(a)])
  if abs(x - y) < ans:
    ans = abs(x - y)

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

# すべて偶数か判定
if all(a % 2 == 0 for a in A):
    if P == 0:
        print(2**N)
    else:
        print(0)
else:
    print(2**(N-1))
# Judge status: Wrong Answer

A, B = map(int, input().split(" "))

A_, B_ = A, B
common = 1
n_max = int(min(A,B)**0.5+1)

for n in range(2, n_max+1):
    while True:
        if (A_ % n == 0) and (B_ % n == 0):
            common *= n
            A_ = A_ // n
            B_ = B_ // n
        else:
            break

print(common * A_ * B_)
# Judge status: Accepted
import math
A, B = map(int, input().split())
print(1+math.ceil((B-A)/(A-1)))
# Judge status: Accepted
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()
b=n1()
c=n1()

a.sort()
b.sort()
c.sort()

from bisect import bisect_left,bisect_right
b2=[]
for i in b:
    b2.append(bisect_left(a,i))

import itertools
b3=list(itertools.accumulate(b2))
    
ans=0
for i in c:
    t=bisect_left(b,i)
    if t>0:
        ans+=b3[t-1]
    
print(ans)
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
A=[]

for i in range(1,101):
    if a%i == 0 and b%i==0:
        A.append(i)
print(A[k-1])
# Judge status: Accepted
A,B = map(int,input().split())

count = 0
for i in range(A,B+1):
    i = str(i)
    if (i[0]==i[-1])and(i[1]==i[-2]):
        count += 1
print(count)
# Judge status: Accepted
k, x = map(int, input().split())
ans =[]
for i in range(x-k+1, x+k):
  ans.append(i) 
  
ans = map(str, ans)
print(' '.join(ans))
# Judge status: Accepted
print(eval('-(-('+input().replace(' ','+')+')//2)'))
# Judge status: Accepted
a,b=map(int,input().split(" "))
print([":(","Yay!"][max(a,b)<9])
# Judge status: Accepted
n = int(input())
import heapq
a = []
heapq.heapify(a) # リストを変換
z = []
for i in range(n):
    ai = int(input())
    z.append(ai)
    if i < 2:
        heapq.heappush(a, ai)
    else:
        t = heapq.heappop(a)
        #print(ai, t)
        heapq.heappush(a, max(ai, t))

x2 = heapq.heappop(a)
x1 = heapq.heappop(a)

for zi in z:
    if x1 != zi:
        print(x1)
    else:
        print(x2)
# Judge status: Accepted
N = input()
A = N[::-1]
#print(N)
#print(A)
cont = 0
for i in range(len(N)):
	if N[i] > A[i]:
		cont+=1
print(cont)
# Judge status: Accepted
arr = input().split()
arr = list(map(int,arr))
a = int(arr[0])
b = int(arr[1])
c = int(arr[2])

if a <= c and c <= b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
m = round(sum(l)/len(l))
ans = 0
for i in range(len(l)):
  ans += (m - l[i])**2

print(ans)
# Judge status: Wrong Answer
x = int(input())

print((x//11)*2+int("01111122222"[x%11]))
# Judge status: Wrong Answer
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
import itertools

N, M, Q = MAP()
a, b, c, d = [], [], [], []
for _ in range(Q):
    ai, bi, ci, di = MAP()
    a.append(ai-1); b.append(bi-1); c.append(ci); d.append(di)


def solve(lst):
    ans = 0
    for i in range(Q):
        if lst[b[i]] - lst[a[i]] == c[i]:
            ans += d[i]
    return ans

ans = 0
for A in itertools.combinations_with_replacement(range(1, 11), N):
    ans = max(ans, solve(A))

print(ans)
# Judge status: Accepted
A, B, C, X = [int(input()) for x in range(4)]
cnt = 0

for a in range(A+1):
    x = X - 500*a
    if x < 0:
        break
    for b in range(B+1):
        y = x - 100*b
        if y < 0:
            break
        else:
            if y/50 <= C:
                cnt += 1
print(cnt)
# Judge status: Accepted
x,a,b=map(int,input().split())
print('delicious' if b<=a else 'safe' if b<=a+x else 'dangerous')
# Judge status: Accepted
N = input()
if '9' in N:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    x=II()
    ans=x//11*2
    x%=11
    if x>6:ans+=2
    elif x>0:ans+=1
    print(ans)

main()
# Judge status: Accepted
from collections import defaultdict
def main():
    n=int(input())
    A=list(map(int,input().split()))
    B,C=[0]*n,[0]*n
    for i,a in enumerate(A):
        B[i]=a+i
        C[i]=i-a
    D=defaultdict(int)
    D[C[-1]]+=1
    ans=0
    for i in range(n-1)[::-1]:
        ans+=D[B[i]]
        D[C[i]]+=1
    print(ans)
    
if __name__=='__main__':
    main()
# Judge status: Accepted
import itertools
import math

N = int(input())

loc = [[int(s) for s in input().split()] for _ in range(N)]

dist = [[0] * N for _ in range(N)]

for i in range(N):
    for j in range(i + 1, N):
        dist[i][j] = math.sqrt((loc[i][0] - loc[j][0])** 2 + (loc[i][1] - loc[j][1])** 2)
        dist[j][i] = dist[i][j]

d_cnt = 0
cnt = 0
for per in itertools.permutations(list(range(N)), N):
    for i, j in zip(per, per[1:]):
        d_cnt += dist[i][j]
    cnt += 1

print(d_cnt / cnt)
# Judge status: Accepted
import sys

N, K = map(int, sys.stdin.readline().rstrip().split())
D = set(map(str, sys.stdin.readline().rstrip().split()))


for i in range(N, N*10+1):
    price_str = str(i)
    for num_str in price_str:
        if num_str in D:
            break
    else:
        print(price_str)
        sys.exit()
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

num_list = []

for i in range(1,101):
    if a % i == 0 & b % i == 0:
        num_list.append(i)

# num_list.sort(reverse = True)

print(num_list[-k])
# Judge status: Accepted
s=input()
print("Yes" if all((i%2==0 and s[i] in "RUD") or (i%2!=0 and s[i] in "LUD") for i in range(len(s))) else "No")
# Judge status: Accepted
A=int(input())
B=int(input())
L=[1,2,3]
L.remove(A)
L.remove(B)
print(L[0])
# Judge status: Wrong Answer
N = int(input('整数を入力してね>'))
x = (800 * N)
y = (int(N/15)*200)
print(x - y)
# Judge status: Wrong Answer
w = input()
beau = {}
for i in range(len(w)):
    if not w[i] in beau:
        beau[w[i]] = 1
    else:
        beau[w[i]] += 1
num = sum(list(map(lambda x: x%2,list(beau.values()))))
if num == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
a4 = 0
a2 = 0
a1 = 0

for a in A:
    if a % 4 == 0:
        a4 += 1
    elif a % 2 == 0:
        a2 += 1
    else:
        a1 += 1

if a2 == 0 and a1 <= a4 + 1:
    print('Yes')
elif a4 >= a1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():

    S = input()

    n = len(S)
    a = "10" * (n // 2) + "1" * (n % 2)
    b = "01" * (n // 2) + "0" * (n % 2)

    result = min(bin(int(S, 2) ^ int(a, 2)).count("1"),
                 bin(int(S, 2) ^ int(b, 2)).count("1"))

    print(result)


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

if n == 1:
  print(1)
else:
  a1 = max(a) - min(a) + 1
  res = []
  for i in a:
    res.append(i-1)
    res.append(i)
    res.append(i+1)
  
  res.sort()
  ans = 0
  for j in range(1,a1):
    c = res.count(j)
    ans = max(ans, c)
  
  print(ans)
# Judge status: Wrong Answer
x=int(input())
a=[]
for i in range(1,110):
  for j in range(2,100):
    if i**j<=x:
      a.append(i**j)
print(a[-1])
# Judge status: Accepted
s_num=int(input())
s=[]
for i in range(s_num):
	s.append(input())  

t=[]
t_num=int(input())
for i in range(t_num):
	t.append(input()) 

max=0

for i in range(s_num):
    if max < int(s.count(s[i]) - t.count(s[i])):
        max = int(s.count(s[i]) - t.count(s[i]))
        #print('int(s.count(s[i]) - t.count(s[i]))=',int(s.count(s[i]) - t.count(s[i])))
print(max)
# Judge status: Accepted
import collections as cc
import sys
import bisect as bi
I=lambda:list(map(int,input().split()))
n,x,t=I()
print((n+x-1)//x*t)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

if abs(a-b)+abs(b-c) <= d*2 or abs(a-c) <= d:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
    print('B')
else:
    print('A')
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]
a = [0] * 3
b = [0] * 3
b[0] = c[0][0]
for i in range(1, 3):
    a[i] = c[i][0] - b[0]
for i in range(1, 3):
    b[i] = c[0][i] - a[0]
for i in range(3):
    for j in range(3):
        if a[i] + b[j] != c[i][j]:
            print('No')
            exit(0)
print('Yes')
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()
s1 = []
t1 = []
for i in range(0 , len(s)):
  s1.append(s[i])
for i in range(0 , len(t)):
  t1.append(t[i])
a = set(s1 + t1)
if len(s1) == n:
	print(len(a))
print(a)
# Judge status: Accepted
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X, T = MAP()
print(0--N//X*T)
# Judge status: Wrong Answer
s=input().split('/')
if int(s[0])<2018:print('Heisei')
elif int(s[1])==2019 and int(s[2])<=4:print('Heisei')
else:print('TBD')
# Judge status: Accepted
n,m=map(int,input().split())
stu=[list(map(int,input().split()))for i in range(n)]
po=[list(map(int,input().split()))for i in range(m)]
for i in stu:
    tmp=10**12
    for j in po:
        ab=abs(i[0]-j[0])+abs(i[1]-j[1])
        if ab<tmp:
            tmp=ab
            ans=po.index(j)
    print(ans+1)
# Judge status: Accepted
k,x = map(int, input().split())
if k*500 >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
def main():
    D = int(input())
    c = list(map(int, input().split()))
    last = [0] * 27
    for d in range(1, D+1):
        s = list(map(int, input().split()))
        max_s = max(s)
        index_s = s.index(max_s)
        print(index_s)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c, d = map(int, input().split())
lst = [a * c, a * d, b * c, b * d]
print(max(lst))
# Judge status: Accepted
#Candy Distribution Again
n,x = map(int, input().split())
s= list(map(int,input().split()))

s.sort()
s.reverse
ans=0
if s[0]>x:
    print(ans)
else :
    for i in s:
        x=x-i
        if x>=0:
            ans+=1
        else :
            break
    if x>0:
        ans-=1
    print(ans)
# Judge status: Wrong Answer
n=int(input())
a=[int(input()) for i in range(n)]
import fractions
maxi=0
for i in range(n-1):
    x=fractions.gcd(a[i],a[i+1])
    lcm=a[i]*a[i+1]/x
    maxi=max(maxi,lcm)
print(int(maxi))
# Judge status: Accepted
s=input()
n=int(input())
f=0
l=""
r=""
for i in range(n):
	q=input().split()
	if q[0]=="1":
		f^=1
	else:
		if (f==0 and q[1]=="1") or (f==1 and q[1]=="2"):
			l=l+q[2]
		else:
			r=r+q[2]

if f==0:
	ans=l[::-1]+s+r
else:
	ans=r[::-1]+s[::-1]+l

print(ans)
# Judge status: Accepted
S = input()

S = S[::-1]
N = len(S)
cnt = [0] * 2019
mod = 2019
m = 0
cnt[0] += 1
for i in range(N):
    s = int(S[i]) * (pow(10, i, mod))
    s %= mod
    m += s
    m %= mod
    cnt[m] += 1


ans = 0
for i in cnt:
    ans += (i * (i-1)) // 2

print(ans)
# Judge status: Accepted
n = input()

if '7' in n:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a=list(map(int,input().split()))
if a.count(5)==2 and a.count(7)==1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
O = input()
E = input()

print(''.join(a + b for a, b in zip(O, E)))
# Judge status: Accepted
#!/usr/bin/env python3

X, Y, A, B, C = list(map(int, input().split()))
p_list = list(map(int, input().split()))  # 10 ** 5
q_list = list(map(int, input().split()))
r_list = list(map(int, input().split()))

p_list = list(sorted(p_list, reverse=True))
q_list = list(sorted(q_list, reverse=True))
# r_list = sorted(r_list, reverse=True)

p_list = p_list[:X]
q_list = q_list[:Y]

all_list = p_list + q_list + r_list
all_list = list(sorted(all_list, reverse=True))
total = sum(all_list[: X + Y])


ans = total
print(ans)
# Judge status: Accepted
n = int(input())
res = 10000
for i in range(1, n // 2 + 1):
  s = str(i)
  t = str(n - i)
  cnt = 0
  for j in s + t:
    cnt += int(j)
  res = min(res, cnt)
print(res)
# Judge status: Accepted
x = int(input())
n = 100
c = 0
while n < x:
    n = int(n*1.01)
    c += 1
print(c)
# Judge status: Accepted
S, c = map(int, input().split())
if 2 * S > c:
    print(c // 2)
    exit()
ans = S
rest_c = c - 2 * S
ans += rest_c // 4
print(ans)
# Judge status: Accepted
import sys

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


def solve():
    S = input()
    
    ans = 0
    ps, cs = '', ''
    for si in S:
        cs += si
        if cs != ps:
            ps = cs
            cs = ''
            ans += 1
    print(ans)


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

count= 0
count2 = 0
Nagasa = len(X)

for i in range (0, len(X)):
	if count2 == int(Nagasa/2):
		print(2*count)
		exit()
	if X[i] == 'T':
		count+=1
		count2+=1
	if X[i] == 'S':
		count-=1

print(0)
# Judge status: Accepted
S = input()

ans = 'Yes'
while S:
    if S.startswith('hi'):
        S = S[2:]
    else:
        ans = 'No'
        break

print(ans)
# Judge status: Accepted
N=int(input())
*A,=map(int, input().split())
B=[0]*(10**5+3)
for a in A:
    a+=1
    B[a-1]+=1
    B[a]+=1
    B[a+1]+=1
print(max(B))
# Judge status: Accepted
def main():
    n = int(input())
    ary = [int(i) for i in input().split()]
    ary = sorted(ary)

    if ary[0] == 0:
        print(0)
        return

    prod = 1
    for i in reversed(range(n)):
        prod *= ary[i]
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)
main()
# Judge status: Accepted
N = int(input())
J = [tuple(map(int, input().split())) for _ in range(N)]

J.sort(key=lambda x: (x[1], -x[0]))

t = 0
for a, b in J:
    if t + a > b:
        res = 'No'
        break
    else:
        t += a
else:
    res = 'Yes'

print(res)
# Judge status: Accepted
W, H, N = map(int, input().split())

lstx = [[0], [W]]
lsty = [[0], [H]]

for i in range(N):
    x, y, a = map(int, input().split())
    if a==1 or a==2:
        lstx[a-1].append(x)
    else:
        lsty[a-3].append(y)

xmax = max(lstx[0])
xmin = min(lstx[1])
ymax = max(lsty[0])
ymin = min(lsty[1])

if xmax <= xmin and ymax <= ymin:
    print((xmax-xmin)*(ymax-ymin))
else: print(0)
# Judge status: Accepted
s = input()
if s[1:].count("9") == len(s)-1:
    print(sum(map(int, s)))
else:
    print(int(s[0])-1 + 9*(len(s)-1))
# Judge status: Accepted
def main():
    A, B, C, K = map(int, input().split())
    if K%2 == 0:
        print(A-B)
    else:
        print(B-A)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
S = list(input())

Lw = 0
Re = S[1:].count("E")
ans_lst = [Lw+Re]*(N)

# i+1をリーダーとみなす
for i in range(1,N):
    if S[i-1] == "W":
        Lw += 1
    else:
        Re -= 1
    ans_lst[i] = Lw + Re

ans = min(ans_lst)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

r = b//a
if r >= c:
    print(c)
else:
    print(r)
# Judge status: Wrong Answer
N = int(input())
AA= list(map(int,input().split()))
AA.sort(reverse=True)
ccurrent = AA.pop(0)
conf = 0
for a in AA:
  conf+=ccurrent
  ccurrent = a
print(conf)
# Judge status: Accepted
n=int(input())
if n%2 == 1:
	print("0")
else:
	k = n//2
	cnt = 1
	ans = 0
	while True:
		if k//(5**cnt) >= 1:
			ans += k//(5**cnt)
			cnt += 1
		else:
			break
	print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
print((A+B)%24)
# Judge status: Accepted
s = input()
for i in range(len(s)-1):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
print("Good")
# Judge status: Accepted
from itertools import combinations
L  = []
for i in range(5):
    L.append(int(input()))
k = int(input())
for i,j in combinations(L,2):
    if abs(i-j) > k:
        print(":(")
        break
else:
    print("Yay!")
# Judge status: Accepted
s = input()

def put_key(x,ans):
  if x =="0":
    return ans + "0"
  elif x== "1":
    return ans + "1"
  else:
    ls = list(ans)
    if len(ls) == 0:
      return ans
    else:
      ls[-1] = ""
      return  "".join(ls)

ans =str("")
for t in range(len(s)):
  ans = put_key(s[t],ans)
print(ans)
# Judge status: Accepted
def find(H1,M1,H2,M2,K):
    left = H1*60+M1
    right = H2*60+M2
    remain = right-left-K
    return max(remain,0)
H1,M1,H2,M2,K = list(map(int,input().strip().split()))
print(find(H1,M1,H2,M2,K))
# Judge status: Accepted
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
print(a[0]*10+a[1]+a[2])
# Judge status: Accepted
import math
A,B = input().split()
A = int(A)
B = float(B)
B = round(B*1000)
B = int(B)
print(math.floor(A*B//1000))
# Judge status: Accepted
from math import gcd
X, Y = map(int, input().split())
l = X * Y // gcd(X, Y)
if l == X:
    print(-1)
else:
    print(X)
# 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())
if n%2 == 1:
    print(0)
else:
    ans = 0
    cnt = 1
    while n>=(5**cnt):
        ans += n//(5**cnt)//2
        cnt += 1
    print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

import numpy as np

def main():
	n=II()
	A=[II() for _ in range(5)]
	ans=0

	for i in A:
		ans=max(ans,(n-1)//i)

	ans+=5

	print(ans)









if __name__ == "__main__":
	main()