peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import heapq
n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
x_range = []
cut = [0]
count = 0
for i in range(m-1):
    x_range.append(abs(x[i]-x[i+1]))
h = heapq.nlargest(n-1,x_range)


for i in h:
    cut.append(x_range.index(i)+1)
cut.append(len(x))
print(1)
'''
for i in range(len(cut)-1):
    sum_range = x[cut[i]:cut[i+1]]
    count += abs(sum_range[0]-sum_range[len(sum_range)-1])
print(count)
'''
# Judge status: Wrong Answer
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    V = list(map(int, sys.stdin.buffer.readline().split()))
    V.sort(reverse=True)

    ret = 0
    for n in range(N-1):
        if ret == 0:
            ret = (V[n] + V[n+1]) / 2
        else:
            ret = (ret + V[n+1]) / 2
    print(ret)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(m)]

for x in range(1000):
    keta = 1
    nx = x // 10
    d = []
    d.append(x%10)
    while nx:
        keta += 1
        d = [nx%10] + d
        nx //= 10
    if keta != n: continue
    ok = True
    for i in range(m):
        if d[p[i][0] - 1] != p[i][1]: ok = False
    if ok: 
        print(x)
        exit() 
print(-1)
# Judge status: Accepted
A, B, C, K = map(int, input().split())

# a = 0a + b + c
# b = 0b + a + c
# c = 0c + a + b
# a - b = - a + b

# a = 2a + b + c
# b = 2b + a + c
# c = 2c + a + b
# a - b = 2a + b + c - 2b - a - c = a - b

# a = 2a + 3b + 3c
# b = 2b + 3a + 3c
# c = 2c + 3a + 3b
# a - b = 2a + 3b + 3c - 2b - 3a - 3c =  - a + b

if abs(A - B) > 1e18:
    print("Unfair")
elif K % 2 == 0:
    print(A - B)
else:
    print(B - A)
# Judge status: Accepted
n,m=map(int,input().split())
a=map(int,input().split())

from fractions import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
l=1

max2=0
min2=1000

for i in a:
    factor=(i^(i-1)).bit_length()
    max2=max(max2,factor)
    min2=min(min2,factor)
    l=l*i//2//gcd(l,i//2)
    if l>m:
        break

if l>m or min2!=max2:
    print(0)
else:
    ans=1 if l<=m else 0
    m-=l
    print(ans+max(0,m//(2*l)))
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if a >= b or a+x >= b:
    print("delicious")
elif a+x+1 >= b:
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
x=int(input())

if x<=6:
    print("1")
    exit()
elif x<=11:
    print("2")
    exit()
else:
    ans=((x//11)*2)
    if x%11<=6:
        print(ans+1)
    else:
        print(ans+2)
# Judge status: Accepted
import math
a, b, c = map(int, input().split())
if (c - a - b)**2 > 4 * a * b and c - a - b > 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
s = input()
ans ="Yes"
if n%2==1:ans="No"
else:
	for i in range(n//2):
		if s[i]!=s[n//2+i]:ans="No"
print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))

if n<=2:
  print(1)
  exit()
  
cnt=0

if l[0]>l[1]:
  ans="low"
elif l[0]<l[1]:
  ans="high"
else:
  ans="even"
  
for i in range(2,n):
  if l[i-1]>l[i] and (ans=="low" or ans=="even"):
    ans="low"
  elif l[i-1]<l[i] and (ans=="high" or ans=="even"):
    ans="high"
  elif l[i-1]==l[i]:
    continue
  else:
    cnt+=1
    ans="even"
    
print(cnt+1)
# Judge status: Wrong Answer
class henkan:

    def __init__(self, a):

        if(a.islower()):
            henkan.upper1(a)
        else:
            henkan.lower1(a)
    
    def upper1(a):
        print(a.upper())
    
    def lower1(a):
        print(a.lower())



a = input()
henkan(a)
# Judge status: Wrong Answer
n=int(input())
c=list(input())
lc=len(c)
if "W" not in c or "R" not in c:
    print(0)
else:
    ctr = c.count("R")
    if c[0] == "W":
        print(min(ctr-1, lc-ctr))
    else:
        c.pop(0)
        print(min(ctr, lc-ctr))
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for dy in range(n-m+1):
    for dx in range(n-m+1):
        flag = True
        for row in range(m):
            for col in range(m):
                if b[row][col] != a[dy+row][dx+col]:
                    flag = False
        if flag:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
"""
0からLまで行き、LからRまで行く = abs(L) + (R-L)
0からRまで行き、RからLまで行く = abs(R) + (R-L)
"""

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 1<<60

for i in range(0, N-K+1):
  left = A[i]
  right = A[i+K-1]
  ans = min(ans, min(abs(left), abs(right)) + right - left)
print(ans)
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

if '##' in s[b-1:d] or '##' in s[a-1:c]:
    print('No')
elif c > d and '...' not in s[b-2:d+1]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n, k = inm()
H = inl()
H.sort()


def solve():
    if k >= n:
        return 0
    return sum(H[: n - k])


print(solve())
# Judge status: Accepted
S = input()
N = len(S)
reverse = S[::-1]
first = S[:(N - 1) // 2]
second = S[(N + 1) // 2:]

if S == reverse and first == second:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
count = 1
increase = False
decrease = False
for i in range(1,N):
    if A[i-1] == A[i]:
        continue
    elif increase and A[i-1] < A[i]:
        continue
    elif decrease and A[i-1] > A[i]:
        continue
    elif not increase and not decrease and A[i-1] < A[i]:
        increase = True
    elif not increase and not decrease and A[i-1] > A[i]:
        decrease = True
    else:
        count += 1
        increase = False
        decrease = False
print(count)
# Judge status: Accepted
S=input()

ans = min(S.count('0'), S.count('1'))

print(ans*2)
# Judge status: Wrong Answer
import math
N = list(map(int, input().split()))
X = [i for i in range(int(N[0]*(1/0.08)), math.ceil((N[0]+1)*(1/0.08)))]
Y = [i for i in range(int(N[1]*(1/0.10)), math.ceil((N[1]+1)*(1/0.10)))]
#print(X, Y)
cand = set(X) & set(Y)
if len(cand) == 0:
  print(-1)
else:
  print(min(cand))
# Judge status: Wrong Answer
a,b = map(int,input().split())
print(a if a<=b else b)
# Judge status: Wrong Answer
x = int(input())

if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 < x <= 1999:
    print(1)
# Judge status: Wrong Answer
n,k,q=map(int,input().split())
A=[k-q]*n
for i in range(q):
    A[int(input())-1]+=1

ans=0

for i in range(n):
    if A[i]>=0:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
x = int(input())

dp = [0]*200000

def max_sum():
  global dp
  for i in range(x):
    dp[i+100] = max(dp[i+100], dp[i]+1)
    dp[i+101] = max(dp[i+101], dp[i]+1)
    dp[i+102] = max(dp[i+102], dp[i]+1)
    dp[i+103] = max(dp[i+103], dp[i]+1)
    dp[i+104] = max(dp[i+104], dp[i]+1)
    dp[i+105] = max(dp[i+105], dp[i]+1)
  return 

max_sum()

print(min(dp[x], 1))
# Judge status: Accepted
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, M = map(int, input().split())
if N>M:
    N, M = M, N

if N==1 and M==1:
    print(1)
elif N==1 and M!=1:
    print(M-2)
elif N==2:
    print(0)
else:
    v = N*M - 2*M - 2*(N-2)
    print(v)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
x=[0]*(10**5+1)
for i in a:
    x[i]+=1
for i in range(1,10**5):
    ans=max(ans,x[i-1]+x[i]+x[i+1])
print(ans)
# Judge status: Wrong Answer
array = input().split()

a = int(array[0])
b = int(array[1])
c = int(array[2])
d = int(array[3])

if b > 0 and d > 0:
    print(b*d)
elif b <= 0 and d <= 0:
    print(a*c)
elif b <= 0 and d > 0:
    print(b * c)
elif b > 0 and d <= 0:
    print(a * d)
# Judge status: Accepted
import queue
N,M = map(int, input().split())
r = [[] for _ in range(N)]
for i in range(M):
    A,B=map(int, input().split())
    r[A-1].append(B)
    r[B-1].append(A)
ans =[0]*(N+1)
q = queue.Queue()
q.put(1)
while not q.empty():
    qg = q.get()
    for ri in r[qg-1]:
        if ans[ri] == 0:
            ans[ri] = qg
            q.put(ri)
print("Yes")
for i in range(2,N+1):
    print(ans[i])
# Judge status: Accepted
x,k,d = map(int,input().split())
x = abs(x)
if x - k*d > x%d:
    print(x - k*d)
else:
    if x%d == 0 and x // d <= k:
        if (k - x//d)%2 == 0:
            print(0)
        else:
            print(d)
    else:
        if (k - x // d) % 2 == 1:
            print(abs(x%d-d))
        else:
            print(x%d)
# Judge status: Accepted
N = int(input())
print((N)*(N-1) //2)
# Judge status: Accepted
N,L=map(int,input().split())
Iroha=[]
for i in range (0,N):
    Iroha.append(input())

print(''.join(sorted(Iroha)))
# Judge status: Accepted
N,*D=map(int,open(0).read().split())
S=sorted(D,reverse=True)
if S[1]==S[0]:
  [print(S[0]) for i in range(N)]
else:
  import numpy as np
  max_i=np.arange(N)[np.array(D)==S[0]]
  for i in range(N):
    if i==max_i:
      print(S[1])
    else:
      print(S[0])
# Judge status: Accepted
# -*- coding: utf-8 -*-

N = int(input())
SP = list()
for i in range(N):
    s, p = map(str, input().split())
    SP.append([s, int(p), i + 1])

SP.sort(key=lambda x: x[1], reverse=True)
SP.sort(key=lambda x: x[0])

for sp in SP:
    print(sp[2])
# Judge status: Accepted
X = int(input())
from itertools import count
for t in count(1,1):
    if (t-1)*t >= 2*(X-t):
        print(t); break
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
S =input()
a = 0
b = 0

for i in range(N):
  if S[i]=='a' and a+b < A+B:
    a +=1
    print('Yes')
  elif S[i]=='b' and b < B:
    b +=1
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
# coding: utf-8

def main():
    N = int(input())
    v = list(map(int, input().split()))
    v.sort()
    ans = v[0] / 2 ** (N - 1)
    for i in range(1, N):
        ans += v[i] / 2 ** (N - i)

    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
A,B,C=map(int,input().split())
if A*C<=B :
  print(C)
else:
  print(B//A)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))
c = [0] * n
for i in range(1, n):
    x=h[i]
    c[i] = min([c[j]+abs(x-h[j]) for j in range(max(0, i-k), i)])
print(c[n-1])
# Judge status: Accepted
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())
if a>b:
    t *= -1
if abs(b + w*t) <= abs(a + v*t):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N = int(input())
 
c = [[0]*10 for _ in range(10)]
for i in range(1,N+1):
	c[int(str(i)[0])][int(str(i)[-1])] += 1
    
ans = 0
for i in range(1, 10):
	for j in range(1, 10):
		ans += c[i][j]*c[j][i]

print(ans)
# Judge status: Wrong Answer
n=int(input())
z=0
while n!=0:
  z+=n//2
  n=n//2
print(z)
# Judge status: Wrong Answer
h, n = input().split();
h = int(h);
n = int(n);

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

if sum(A) > h:
  print("No");
else:
  print("Yes");
# Judge status: Wrong Answer
input = open(0).readline
s = {}
s['A'] = list(input().strip())
s['B'] = list(input().strip())
s['C'] = list(input().strip())

play_order = {'A':'B', 'B':'C', 'C':'A'}

def play(player):
    
    if  s[player] == []:
        print(next_play)
        play(play_order[player])
    
    next_play = s[player].pop()
    if s[player] == []:
        print(next_play)
        return player
    
    play(next_play.upper())
        
play('A')
# Judge status: Accepted
import math
ans=0
A=[int(input()) for i in range(5)]
a=10
p=0
for i in range(5):
  if a>(A[i]%10) and A[i]%10!=0:
    p=i
    a=A[i]%10
for i in range(5):
  if i==p:
    ans+=A[i]
  else:
    ans+=10*(math.ceil(A[i]/10))
print(ans)
# Judge status: Accepted
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
i = l[0]
while i % 2 == 0:
    ans += 1
    i /= 2
for i in l[1:]:
    c = 0
    while i % 2 == 0 and c <= ans:
        c += 1
        i /= 2
    if c <= ans:
        ans = c
print(ans)
# Judge status: Wrong Answer
s=str(input())
s=list(s)
print(s)
if s[5]=="0" and (s[6]=="1" or s[6]=="2" or s[6]=="3" or s[6]=="4"):
  print("Heisei")
else:
  print("TBD")
# Judge status: Wrong Answer
"""Boot-camp-for-Beginners_Easy003_B_Qualification-simulator_19-August-2020.py"""
import numpy as np
import sys

N, A, B = map(int, input().split())
S = str(input())

for i in range(N):
    if(S[i] == "c"):
        print("No")
    else:
        if(i >= A+B):
            print("No")
        else:
            if(S[i] == "b" and i < B):
                print("No")
            else:
                print("Yes")
# Judge status: Wrong Answer
s = list(input().rstrip())
n=len(s)+1
from_left = [0]*n
from_right = [0]*n
ans=0
i=0
while i<n-1:
    if s[i] == '>':
        from_left[i] = 0
    else:
        from_left[i] = from_left[i-1]+1
    i+=1
i=n-2
while i>-1:
    if s[i] == '<':
        from_right[i]=0
    else:
        from_right[i] = from_right[i+1]+1
    i-=1
for i in range(0, n-1):
    ans+=max(from_left[i], from_right[i+1])
print(ans)
# Judge status: Accepted
n, m, x = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(n)]

ans = 1000000000000
flag = 0
for i in range(2**n):
    u = [0]*m
    tmp = 0
    for j in range(n):
        if ((i>>j)&1) :
            l = li[j]
            tmp += l[0]
            for k in range(m):
                u[k] += l[k+1]
    if all(i >= x for i in u):
        flag = 1
        ans = min(tmp, ans)
if flag:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
MOD = int(1e9+7)
def main():
    n,k = map(int,input().split())
    ans = 0
    for i in range(k,n+2):
        # min_sum = sum(range(i))
        min_sum = i*(i-1)//2
        # max_sum = sum(range(n,n-i,-1))
        max_sum = (2*n-i+1)*(i)//2
        # print(min_sum,max_sum)
        ans = (ans + (max_sum-min_sum+1))%MOD
    print(ans)
    return

if __name__ == "__main__":
    main()
# Judge status: Accepted
A, B, M = map(int,input().split())
listA = list(map(int,input().split()))
listB = list(map(int,input().split()))
ans = min(listA) + min(listB)
for _ in range(M):
    x,y,c = map(int,input().split())
    temp = listA[x-1]+listB[y-1]-c
    ans = min(ans,temp)
print(ans)
# Judge status: Accepted
from fractions import gcd

N = int(input())

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

l = A[0]
for a in A:
  l = (l * a) // gcd(l,a)
num=0
for a in A:
  num += l//a
print(num % (10**9 +7))
# Judge status: Accepted
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b, c = na()
print(min(b // a, c))
# Judge status: Accepted
n,k,x,y = (int(input()) for i in range(4))
if k < n:
    print(k*x + y*(n-k))
else:
    print(x*n)
# Judge status: Accepted
X = int(input())

pos = 0
i = 0
while pos < X:
    i += 1
    pos += i
print(i)
# Judge status: Accepted
from collections import defaultdict
N, M = map(int, input().split())
ab = defaultdict(list)
for i in range(M):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

ans = "IMPOSSIBLE"
for u in ab[1]:
    if N in ab[u]:
        ans = "POSSIBLE"
        break
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
if n >= 2:
   ans = a[0]
for i in range(n-2):
   ans += a[i//2+1]
print(ans)
# Judge status: Accepted
N = int(input())
S=[]

for n in range(N):
    S.append(input())

AC ='AC x '
WA ='WA x '
TLE ='TLE x '
RE ='RE x '


print(AC + str(S.count("AC")))
print(WA + str(S.count("WA")))
print(TLE + str(S.count("TLE")))
print(RE + str(S.count("RE")))
# Judge status: Accepted
s = input()
n = len(s)

s = s.replace('?','D')
print(s)
# Judge status: Accepted
N = int(input())
ans = 0
l = [[0 for _ in range(10)] for _ in range(10)]
for A in range(1, N + 1):
    A = str(A)
    a = int(A[0])
    z = int(A[-1])
    l[a][z] += 1

for i in range(10):
    for j in range(10):
        ans += l[i][j] * l[j][i]

print(ans)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        s=input()
        t=input()
        if s==t:
            return 'Yes'
        else:
            for i in range(1,len(s)+1):
                if s[i:]+s[0:i]==t:
                    return 'Yes'
        return 'No'
    print(main())
resolve()
# Judge status: Wrong Answer
s = input()
if(s[0] == s[1] or s[1] == s[2] or s[2] == s[3]):
  print('Good')
else:
  print('Bad')
# Judge status: Accepted
x, y = map(int, input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-
# C - Scc Puzzle
# 標準入力の取得
N,M = list(map(int, input().split()))

# 求解
if N >= M//2:
    # cc⇒Sを行わず、"Scc"を作成した際に、Sがちょうどまたは余る
    print(M//2)
else:
    # cc⇒Sを行わず、"Scc"を作成した際に、cが余る
    print(N + (M-2*N)//4)
# Judge status: Wrong Answer
from itertools import permutations
from sys import exit
S=input()
for s in permutations('abc'):
  if S == s:
    print('Yes')
    exit(0)
print('No')
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

h, a = MAP()
print(h//a) if h % a == 0 else print(1 + h//a)
# Judge status: Accepted
N = int(input())
c = input()

dp = [0] * (N)

len_c_W = c.count('W')
len_c_R = c.count('R')
if (len_c_W == 0 or len_c_R == 0):
    print(0)
    exit()
cnt_W = 0
cnt_R = 0
for i in range(N):
    if c[i] == 'R':
        cnt_R += 1
    else:
        cnt_W += 1
    count = 0
    if (cnt_W <= (len_c_R - cnt_R)):
        count = len_c_R - cnt_R
    else:
        count = cnt_W

    dp[i] = count
print(min(dp))
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

if len(A) != len(set(A)):
  print("NO")
else:
  print("YES")
# Judge status: Accepted
s = input()
t = input()
n = 0
for i in range(len(s)):
    if s[i] != t[i]:
        n = n + 1
print(int(n))
# Judge status: Wrong Answer
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_A = sum(A)
sum_B = sum(B)
cnt1 = sum_B - sum_A
cnt2 = 0
for a, b in zip(A, B):
    if a > b:
        cnt2 += a - b
    elif b < a:
        cnt2 += math.ceil((b - a) / 2)
if cnt1 < cnt2:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
# coding: utf-8
#n = int(input())
x, y = map(int,input().split())
#A = list(map(int,input().split()))
#ans = 0
ans = abs(abs(x)-abs(y))
if x<0:
    ans += 1
if y < 0:
    ans += 1
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
print("Yes" if N == M else "No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

len_A = len(A)
A = set(A)
if len_A != len(list(A)):
    print("NO")
else:
    print("YES")
# Judge status: Accepted
X, Y = list(map(int,input().split()))
ans = 0
while X <= Y:
    X *= 2
    ans += 1
print(ans)
# Judge status: Accepted

a,b = map(int,input().split())
x = (a+b+1)/2
print(int(x))
# Judge status: Accepted
import fractions

def prime_factorize(n):
    a = []
    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

a, b = list(map(int, input().split()))
print(len(set(prime_factorize(fractions.gcd(a, b))))+1)
# Judge status: Wrong Answer
print("ARC" if input() == "ABC" else "ARC")
# Judge status: Accepted
n, x, t = map(int, input().split())
r = n % x
res = (n // x + 1) * t if n % x != 0 else n // x * t
print(res)
# Judge status: Accepted

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

if n==1 and m==1:
    print(1)
elif m==1:
    print(n-2)
elif n==1:
    print(m-2)
else:    
    print((n-2)*(m-2))
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    S = input()
    print("Heisei" if S <= "2019/04/30" else "TBD")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int, input().split())
w = tx - sx 
h = ty - sy 
ans = ""
for _ in range(h):
  ans += "U"
for _ in range(w):
  ans += "R"
for _ in range(h):
  ans += "D"
for _ in range(w):
  ans += "L"

print(ans)
ans += "L"
for _ in range(h+1):
  ans += "U"
for _ in range(w+1):
  ans += "R"
ans += "D"
ans += "R"
for _ in range(h+1):
  ans += "D"
for _ in range(w+1):
  ans += "L"
ans += "U"
print(ans)
# Judge status: Wrong Answer
s = list(input())
ans = 753 - int(s[0] + s[1] + s[2])
for i in range (len(s) - 2):
  num = s[i] + s[i+1] + s[i+2]
  if ans > abs(int(num)-753):
    ans = abs(int(num)-753)
print(ans)
# Judge status: Accepted
n = int(input())
problems = [int(input()) for _ in range(n)]
sum_all = sum(problems)
not_multi_of_10 = [x for x in problems if x % 10 != 0]
not_multi_of_10.sort()

if sum_all % 10:
    print(sum_all)
else:
    if len(not_multi_of_10) == 0:
        print(0)
    else:
        print(sum_all - not_multi_of_10[0])
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

dp = [10**18] * (10**5+10)
dp[0] = 0

for i in range(n):
  if i+1 < n:
    dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
  if i+2 < n:
    dp[i+2] = dp[i] + abs(h[i+2] - h[i])

print(dp[n-1])
# Judge status: Wrong Answer
x,a,b = map(int,input().split())
a1,b1 = abs(x-a),abs(x-b)
if a1 >= b1:
    print(b1)
else:
    print(a1)
# Judge status: Wrong Answer
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
lis=p[:x]+q[:y]+r
lis.sort(reverse=True)
ans=0
for i in range(x+y):
  ans+=lis[i]
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
time=a+b
print(time if time<=23 else time-24)
# Judge status: Accepted
C= input()
alpa=[chr(ord('a') + i) for i in range(26)]
ans = 1

for c in alpa:
    if c == C:
        break
    ans+=1
print(alpa[ans])
# Judge status: Wrong Answer
n = int(input())
s = input()

m =s.find("#")

if m < 0:
  print(0)
else:
  k = s[m:n].count(".")
  l = s[m-1:n].count("#")
  if k < l: print(k)
  else: print(l)
# Judge status: Wrong Answer
import sys
n=int(input())
p=list(map(int,input().split()))
q=sorted(p)
if p==q:
  print("YES")
  sys.exit()


for i in range(n-1):
  for j in range(i+1,n):
    s=p[i]
    p[i]=p[j]
    p[j]=s
    if p==q:
      print("Yes")
      sys.exit()
    s=p[i]
    p[i]=p[j]
    p[j]=s
      
print("N0")
# Judge status: Accepted
N, K, Q = map(int, input().split())

members = [0 for _ in range(N)]

for _ in range(Q):
    A = int(input()) - 1
    members[A] += 1

for member in members:
    if Q - member < K:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n = int(input())
s = sorted([int(input()) for _ in range(n)])

sumNum = sum(s)
if sumNum % 10 != 0:
  print(sumNum)
  exit()
else:
  for i in s:
    sumNum -= i
    if sumNum % 10 != 0:
      print(sumNum)
      exit()
print(0)
# Judge status: Wrong Answer
N,M,K = input().split()
A = input().split()
B = input().split()

cnt = 0

list = A + B
list = [int(s) for s in list]
list.sort()
ans = min(list)

min = int(int(K)/int(min(list)))
for s in range(len(list)):
    if ans <= int(K):
        cnt += 1
        ans += list[s]

print(cnt)