peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def saiki(n):

    if n == 0:
        return 0
    else:
        return n + saiki(n - 1)

def number(n , m):

    ans = saiki(n) + saiki(m) - n - m

    return ans

def main():
    n , m = map(int , input().split())
    print(number(n , m))

if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
print('Yes' if (s[0]==s[1]==s[2]) or (s[1]==s[2]==s[3]) else 'No')
# Judge status: Accepted
from sys import stdin

input = stdin.readline

def main():
    X = int(input().rstrip())
    ans = 1
    n = X
    while(n % 360 != 0):
        n += X
        ans += 1 
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
sx , sy , tx , ty = map(int,input().split())
a = []

for _ in range(tx - sx):
    a.append("R")
for _ in range(ty - sy):
    a.append("U")
for _ in range(tx - sx):
    a.append("L")
for _ in range(ty - sy):
    a.append("D")
    
a.append("D")

for _ in range(tx - sx + 1):
    a.append("R")
for _ in range(ty - sy + 1):
    a.append("U")
    
a.append("L")
a.append("U")

for _ in range(tx - sx + 1):
    a.append("L")
for _ in range(ty - sy + 1):
    a.append("D")
    
a.append("R")

print("".join(a))
# Judge status: Accepted
A,B,C,D = map(int, input().rstrip().split())
print(min([B, D]) - max([A,C]) if min([B, D]) - max([A,C]) > 0 else 0)
# Judge status: Accepted
from sys import stdin
N=list(map(int,stdin.readline().strip().split()))[0]
eki=[list(map(int,input().split())) for _ in range(N-1)]

for i in range(len(eki)):
    x = eki[i][1]+eki[i][0]
    for j in range(i+1,len(eki)):
        if eki[j][1] >x:
            x=eki[j][1]
            x += eki[j][0]
        elif x%eki[j][2]==0:x+=eki[j][0]
        else:
            x+=eki[j][0]+eki[j][2]-x%eki[j][2]
    print(x)
print(0)
# Judge status: Accepted
def solve():
  N, M = map(int, input().split())
  if M<=2*N:
    ans = M//2
  else:
    ans = N+(M-2*N)//4
  return ans
print(solve())
# Judge status: Wrong Answer
import numpy as np

n = int(input())
A = [int(a) for a in input().split()] 
A.sort()
A.append(-1)

B = [-1] + A[:-1]

A = np.array(A) 
B = np.array(B) 

s = A-B 
ans = len(np.nonzero(s)[0])
if ans == n+1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, K = map(int, input().split())

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

for i in range(K):
  d = int(input())
  LL = list(map(int, input().split()))
  for j in range( len(LL) ):
    L[ LL[j] ] += 1

ans = 0
for i in range(1,N+1):
  if L[i] == 0:
    ans += 1
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(S: str):
    for i in reversed(range(1, len(S) // 2)):
        if S[:i] == S[i:2 * i]:
            print(2 * i)
            return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())
for i in range(x, x+10**5):
    for j in range(2, int(x**0.5)+1):
        if i%j == 0:
            break
    else:
        print(i)
        break
# Judge status: Accepted
a = int(input())
flag = 1

for i in range(1,10):
  for j in range(1,10):
    if i * j == a:
      flag = 0

if flag == 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import copy

def main():
	N = int(input())
	X = [int(x) for x in input().split(" ")]
	sortedX = copy.deepcopy(X)
	sortedX.sort()
	cand = [sortedX[int(N / 2) - 1], sortedX[int(N / 2)]]

	for xi in X:
		if xi <= cand[0]:
			print(cand[1])
		else:
			print(cand[0])

main()
# Judge status: Accepted
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%k==0:
    print('OK')
    exit()
print('NG')
# Judge status: Wrong Answer
N = int(input())
kouho = [1]
for i in range(1, 100):
    t = 6 ** i
    if t <= 10 ** 5:
        kouho.append(t)
    else:
        break
for i in range(1, 100):
    t = 9 ** i
    if t <= 10 ** 5:
        kouho.append(t)
    else:
        break
#print(kouho)

kouho.sort(reverse=True)

ans = 0
cur = 0
while N > 0:
    if N >= kouho[cur]:
        N -= kouho[cur]
        ans += 1
    else:
        cur += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
stones = input()

w_cnt = stones.count('.')
b_cnt = N-w_cnt
first_bi = max(0, stones.find('#'))
last_wi = max(0, stones.rfind('.'))
pw_cnt = stones[first_bi:].count('.')
pb_cnt = stones[:last_wi].count('#')

print(min(w_cnt, b_cnt, pw_cnt, pb_cnt))
# Judge status: Wrong Answer
d = int(input())
c = 'Christmas'
e = 'Eve'
if d == 25:
    print(c)
elif d == 24:
    print(c + e)
elif d == 23:
    print(c + e + e)
else:
    print(c + e + e + e)
# Judge status: Accepted
#   AtCoder abc058 a
#   ストレッチ課題

#   入力
a, b, c = map(int, input().split())

#   判定
if (b - a) == (c - b):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
s = input()

left = [0] * n
right = [0] * n

tmp = 0
for i in range(1, n):
    if s[i - 1] == "W":
        tmp += 1
        left[i] = tmp
    else:
        left[i] = tmp

tmp = 0
for i in range(n - 2, -1, -1):
    if s[i + 1] == "E":
        tmp += 1
        right[i] = tmp
    else:
        right[i] = tmp

res = 10**9
for i in range(n):
    res = min(res, left[i] + right[i])
print(res)
# Judge status: Accepted
import math
import string

def intinput():
    return int(input())

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

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

X, Y, Z = splitintinput()
print(int((X-Z)/(Y+Z)))
# Judge status: Accepted
from collections import deque
import sys
input = sys.stdin.readline
import bisect as bi
from operator import mul
from functools import reduce
import math

def main():
    n = int(input())
    n += 1 if n > 0 else -1
    
    s = ""
    while abs(n) > 1:
        c = "1" if n % 2 == 0 else "0"
        s = c+s 
        n = n // -2 + (0 if n > 0 else 1)

    print(0 if not s else s)
main()
# Judge status: Accepted
N,A,B=map(int,input().split())
S=input()
t_count=0
b_count=0
flag=None

for i in S:
  if i=="c":
    print("No")
  else:
    if i=="a":
      t_count+=1
      if t_count<=A+B:
        print("Yes")
      else:
        print("No")
    else:
      b_count+=1
      if b_count<=B:
        t_count+=1
        if t_count<=A+B:
          print("Yes")
        else:
          print("No")
      else:
        print("No")
# Judge status: Accepted
import heapq as hq
n,m=input().split()
hq.heapify(a:=[-int(x) for x in input().split()])
for i in range(int(m)):hq.heappush(a,-(-hq.heappop(a)//2))
print(-sum(a))
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
A1 = LI()
A2 = LI()
ans = 0
for i in range(N):
    tmp = sum(A1[0:i+1]) + sum(A2[i:])
    ans = max(ans, tmp)
print(ans)
# Judge status: Wrong Answer
a=int(input())
lst=list(map(int,input().split()))
print(a,lst)
cnt=0
for i in range(0,a,2):
    if (lst[i] % 2==1) :
        cnt+=1
        print(i)
print(cnt)
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
for _ in range(n):
  a,b=map(int,input().split())
  l.append([a,b])
l.sort()
ans=0
for a,b in l:
  ans+=min(b,m)*a
  m=max(0,m-b)
print(ans)
# Judge status: Accepted
x = int(input())

div = set()
for i in range(1, int(x**0.5)+1):
    if x % i == 0:
        div.add(i)
        div.add(x//i)

div = list(div)

for d in div:
    for a in range(int(pow(x, 1/2))+1):
        b = a - d
        if a**5 - b**5 == x:
            print(a, b)
            break
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

m = max(a)
res = 0
ans = 0
for i in a:
    if i != m:
        if abs(m//2-i) < res:
            res = abs(m//2-i)
            ans = i

print(m,ans)
# Judge status: Wrong Answer
s,t=input(),input()
ls=len(s)
lt=len(t)
ans=''
for i in range(ls-lt+1):
  c=0
  for j in range(lt):
    if s[i+j]==t[j] or s[i+j]=='?':
      c+=1
  if c==lt:
    ans=s[:i]+t+s[i+lt:]
    print(ans.replace('?','a'))
    break
else:
  print('UNRESTORABLE')
# Judge status: Wrong Answer
input_list = input().split(' ')
a = int(input_list[0])
b = int(input_list[0])

N = a*b

if N%2==0:
    print('Even')
else:
    print('Odd')

del input_list
# Judge status: Accepted
n = int(input())
m = 1000
while m < n:
  m = m + 1000
print(m-n)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))

for _ in range(k):
    b = [0] * n
    for i in range(n):
        left = max(0, i - a[i])
        right = min(n-1, i + a[i])
        b[left] += 1
        if right + 1 < n: b[right + 1] -= 1

    a[0] = b[0]
    for i in range(1, n):
        a[i] = a[i-1] + b[i]
    
    if k >= 20:
        break

print(*a)
# Judge status: Accepted
K = int(input())
S = input()

ans = ""
if len(S) <= K:
    ans = S
else:
    ans = S[:K] + "..."

print(ans)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
choice=[0]*n
ans=[]
cnt=0
for i in reversed(range(n)):
    a=i+1
    c=0
    a+=i+1
    while a<=n:
        c+=choice[a-1]
        a+=i+1
    if c%2!=A[i]:
        choice[i]+=1
        ans.append(i+1)
        cnt+=1
if cnt==0:
    print(0)
else:
    print(cnt)
    ans.sort()
    print(*ans, sep=' ')
# Judge status: Wrong Answer
def awc(s):
    print("ARC" if s == "ABC" else "ABC")

if __name__ == "__main__":
    import sys
    in_str = []
    for line in sys.stdin:
        in_str.append(line)
    awc(in_str[0])
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    flag = "##" not in s[b: d] and "##" not in s[a: c]
else:
    flag = "..." in s[b - 2: d + 1]

print("Yes" if flag else "No")
# Judge status: Wrong Answer
x = int(input())
if x in range(400,599):
    print(8)
if x in range(600,799):
    print(7)
if x in range(800,999):
    print(6)
if x in range(1000,1199):
    print(5)
if x in range(1200,1399):
    print(4)
if x in range(1400,1599):
    print(3)
if x in range(1600,1799):
    print(2)
if x in range(1800,1999):
    print(1)
# Judge status: Accepted

h,n=map(int,input().split())
a=[[int(i) for i in input().split()]for i in range(n)]
inf=10**9
dp=[inf]*(h+1) #0-9
dp[0]=0
mini=inf
for i in range(h+1):
    if dp[i]==inf:
        continue
    for ata,mp in a:
        if i+ata>=h:
            tmp=dp[i]+mp
            mini=min(mini,tmp)
            continue
        dp[i+ata]=min(dp[i+ata],dp[i]+mp)
print(mini)
# Judge status: Accepted
#ABC045.A
a = int(input())
b = int(input())
h = int(input())
#面積を計算する
x = (a+b)*h//2
print(x)
# Judge status: Wrong Answer
s = list(input())
n = len(s)-1
a = [1]+[0]*n
b = [0]+[1]*n
difA = 0
difB = 0

for i in range(1,n):
    a[i] = 0 if a[i-1] == 1 else 1
    b[i] = 0 if b[i-1] == 1 else 1

for j in range(n+1):
    if a[j] != int(s[j]):
        difA += 1
    if b[j] != int(s[j]):
        difB += 1

ans = min(difA,difB)

print(ans)
# Judge status: Accepted
mod = 10 ** 9 + 7
x, y = map(int, input().split())
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if (x + y) % 3 != 0 or a < 0 or b < 0:
    print(0)
    exit()
n = a + b
r = min(a, b)
ans = 1
for i in range(r):
    ans = ans * (n - i) * pow(i + 1, mod - 2, mod) % mod
print(ans)
# Judge status: Accepted
N = int(input())
count = 0
for i in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
        if count >= 3:
            print("Yes")
            break
    else:
        count = 0
if count < 3:
    print("No")
# Judge status: Accepted
import math
def ip():return int(input())
def inp():return map(int,input().split())
def inpstr():return map(str,input().split())
def linp():return list(map(int,input().split()))
def linpstr():return list(map(str,input().split()))

a,b=inp()
ans=0
if a<b:a,b=b,a
ans+=a
a=a-1
if a<b:a,b=b,a
ans+=a
print(ans)
# Judge status: Wrong Answer
S = input()
ans = 0
s = set()
for i in range(len(S)):
  for j in range(i + 4, len(S) + 1):
    s.add(int(S[i:j]))
    
for i in s:
  if i % 2019 == 0:
    ans += 1
    
print(ans)
# Judge status: Wrong Answer
import sys
import math
import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
li0= [int(x) for x in input().split()]
ans=count=0
for i in li0:
  if count<=l:
    count+=i
    ans+=1
  else:
    break
print(ans)
# Judge status: Wrong Answer
x = input()
l = len(x)
s = 0
t = 0
for i in range(l):
    if x[i] == 'S':
        t = x[i+1:].count('T')
        break
for i in range(1, l+1):
    if x[-i] == 'T':
        s = x[:-i].count('S')
        break
print(l-min(s, t)*2)
# Judge status: Accepted

n,k,s = map(int,input().split())
if s == 10 ** 9:
    a = [s] * k
    b = [1] * (n-k)
    a.extend(b)
    print(*a)
else:
    a = [s] * k
    b = [s+1] * (n-k)
    a.extend(b)
    print(*a)
# Judge status: Accepted
from itertools import permutations
x = (int(input()) for _ in range(5))
ans = 650
for p in permutations(x, 5):
  tmp = 0
  for i, v in enumerate(p):
    if i != len(p) - 1:
      tmp += (v // 10 + 1) * 10 if v % 10 else v
    else:
      tmp += v
  ans = min(ans, tmp)
  
print(ans)
# Judge status: Accepted
icase=0
if icase==0:
    s=input()
    imin=999
    for i in range(len(s)-2):
       imin=min(imin,abs(int(s[i:i+3])-753))        
    print(imin)
# Judge status: Wrong Answer
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if a<b:
    if a+v*t>=b+w*t:
        print('YES')
    else:
        print('NO')
else:
    if b+w*t>=a+v*t:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
s = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
    for i in range(n):
        for j in range(i):
            if x[i] == x[j]:
                par[i] = par[j]
                break
    return par

if operation(s, s_par) == operation(t, t_par):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
s = ["" for i in range(n)]
ans = 0
for i in range(n):
  a = input()
  s[i] = a
sorted(s)
ans = len(s)
for i in range (n):
  if s[i] == s[i-1]:
    ans -= 1
print(ans)
# Judge status: Accepted
S=input()
alf=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(S)):
  if S[i] in alf:
    alf.remove(str(S[i]))
  
if len(alf)>0:
  print(alf[0])
  exit()
print('None')
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
n*=4
j=4*(2*q<h)+2*(2*h<s)+(4*q<s)
if j%4==0:
  if 2*s<d:
    print(s*(n//4))
  else:
    print(d*(n//8)+s*((n%8)//4))
  
if j==2 or j==3:
  if 4*h<d:
    print(h*(n//2))
  else:
    print(d*(n//8)+h*((n%8)//2))

if j==5 or j==7:
  if q*8<d:
    print(q*n)
  else:
    print(d*(n//8)+q*(n%8))
# Judge status: Accepted
rgb = int(input().replace(' ', ''))
print('YES' if rgb % 4 == 0 else 'NO')
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 0 <= b:
    print('Zero')
elif 0 < a:
    print('Positive')
else:
    if (b - a + 1) % 2 > 0:
        print('Negative')
    else:
        print('Positive')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
min = 1
check = True
count = 0
for i in range(N):
  if A[i] != min:
    A[i] = 0
    count += 1
  elif A[i] == min:
    min += 1
if A == [0] * N:
  print(-1)
else:
  print(count)
# Judge status: Accepted
s = input()
ans = 0
for i in range(len(s)//2):
    if s[i]!=s[-i-1]:
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
city=[list(map(int,input().split())) for _ in range(n)]
length=[]
for i in range(n-1):
    for j in range(i+1,n):
        len=((city[i][0]-city[j][0])**2+(city[i][1]-city[j][1])**2)
        length.append(len**(0.5))
ans=sum(length)*2/n
print("{:.7f}".format(ans))
# Judge status: Wrong Answer
W,a,b = map(int,input().split())

if b>=a+W:
  print(b-a-W)
else:
  print(a-b-W)
# Judge status: Wrong Answer
H = int(input())

ans = 0
n = 1

def calc(h,n):
    a = h//2
    if a==1:
        n += 2
    else:
        n += 2*calc(a,n)
    return n


if H == 1:
    print(1)
else:
    ans = calc(H,n)
print(ans)
# Judge status: Accepted
N,A,B=map(int,input().split())
S=input()
an=0
bn=0

for i in list(S):
    if i == "a" and an+bn<A+B :
        print("Yes")
        an+=1
    elif i == "b" and an+bn<A+B and bn<B:
        print("Yes")
        bn+=1
    else:
        print("No")
# Judge status: Accepted
N = int(input())
s = [int(input()) for _ in range(N)]
s.sort()
sums = sum(s)

if sums % 10 != 0:
    print(sums)
else:
    for p in s:
        if p % 10 != 0:
            print(sums - p)
            break
    else:
        print(0)
# Judge status: Accepted
import itertools
url = "https://atcoder.jp//contests/abc057/tasks/abc057_a"

def main():
    k, s = list(map(int, input().split()))
    count = 0
    for x, y in itertools.product(range(k+1), range(k+1)):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
    print(count)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>10 or B>10:
    print(-1)
else:
    print(A*B)
# Judge status: Wrong Answer
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**6)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    
    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    a, b, c = map(int, r.split())
    if a+b > c:
        print('No')
    else:
        print('Yes')
    #print()

if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b = (int(i) for i in input().split())
print((a+b)%24)
# Judge status: Accepted
n = int(input())

import math

x = math.ceil(n / 1.08)
m = math.floor(x * 1.08)

if m == n:
    print(int(x))
else:
    print(':(')
# Judge status: Accepted
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

tmpA = [0]*(N+1)
tmpB = [0]*(M+1)
ans = 0

import bisect
for i in range(1,N+1):
    tmpA[i] = tmpA[i-1] + A[i-1]
for i in range(1,M+1):
    tmpB[i] = tmpB[i-1] + B[i-1] 
for i in range(N+1):
    tmp = tmpA[i]
    if tmp > K:
        break
    index = bisect.bisect_right(tmpB,K-tmp)
    ans = max(i+index-1,ans)
print(ans)
# Judge status: Wrong Answer
S,W=[int(i) for i in input().split()]
print("unsafe" if S<W else "safe")
# Judge status: Accepted
n = input()
lis = ["+", "-"]

for x in lis:
  for y in lis:
    for z in lis:
      p = n[0] + x + n[1] + y + n[2] + z + n[3]
      if eval(p) == 7:
        print(p + "=7")
        exit()
# Judge status: Accepted
from collections import deque

N = int(input())
v = list(map(int,input().split()))

v.sort()

deq = deque(v)

while len(deq) != 1:
    x = deq.popleft()
    y = deq.popleft()
    
    nx = (x+y)/2
    
    deq.appendleft(nx)

ans = deq.popleft()

print(ans)
# Judge status: Wrong Answer
from itertools import combinations
import numpy as np

n,m,x = map(int, input().split())
q = [np.array(list(map(int, input().split()))) for _ in range(n)]
L=[]
for i in range(1,n):
    for j in list(combinations(q,i)):
        S = np.sum(j, axis=0)
        if all([k >= x for k in S[1:]]):
            L.append(S[0])

if len(L) >0:
    print(min(L))
else:
    print(-1)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()

count_all = 0
rank_b = 1
for c in S:
  if c == "a":
    if count_all < (A + B):
      print("Yes")
      count_all += 1
    else:
      print("No")
  elif c == "b":
    if count_all < (A + B) and (rank_b <= B):
      print("Yes")
      count_all += 1
      rank_b += 1
    else:
      print("No")
  elif c == "c":
    print("No")
# Judge status: Wrong Answer
import math
N=int(input())
ans=0
flag=0
for i in range(N):
  a=int(input())
  ans+=a//2
  a%=2
  if a==1:
    if flag:
      ans+=1
      a-=1
      flag=0
    else:
      flag=1
  else:
    flag=0
print(ans)
# Judge status: Accepted
n,m,k=map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a, b = [0], [0]

for i in range(n):
  a.append(a[i] + A[i])
for i in range(m):
  b.append(b[i] + B[i])
  
ans, j = 0, m

for i in range(n+1):
  if a[i] > k:
    break
  while b[j] > k - a[i]:
    j -= 1
  ans = max(ans, i + j)
  
print(ans)
# Judge status: Accepted
S=input()
if S.islower():
  print('a')
else:
  print('A')
# Judge status: Accepted
n,m=input().split()
if int(n)>int(m):
    print(m*int(n))
else:
    print(n*int(m))
# Judge status: Accepted
abc = [int(i) for i in input().split()]
if len(set(abc)) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
k=int(input())
x,y=int(input()),int(input())
if(n<k):
    print(n*x)
else:
    print(x*k+(n-k)*y)
# Judge status: Accepted
N = int(input())
L = list(map(int,input().split()))
ans = 0
i = 0
for i in range (N):
 for j in range (i+1, N):
  for k in range (j+1, N):
   if L[i]==L[j] or L[i]==L[k] or L[j]==L[k]:
    ans = ans
   elif L[i]+L[j]<=L[k] or L[i]+L[k]<=L[j] or L[j]+L[k]<=L[i]:
    ans = ans
   else:
    ans = ans + 1
print (ans)
# Judge status: Accepted
import numpy as np
import sys
h,w = map(int,input().split())
if h == 1:
    print(1)
    sys.exit()
if w == 1:
    print(1)
    sys.exit()
if w%2 == 0:
    if h%2 == 0:
        print((w//2)*h)
    else:
        print((w//2)*h)
else:
    if h%2 == 0:
        print(((w//2)+1)*(h//2) + (w//2)*(h//2))
    else:
        print(((w//2)+1)*((h//2)+1) + (w//2)*(h//2))
# Judge status: Wrong Answer
import sys
row = sys.stdin.readline

def read_ints(row):
    return list(map(int, row().split()))
  
K,X = read_ints(row)
print("Yes" if K * X >=  2000 else "No")
# Judge status: Accepted
# 一泊X円、N(泊数)がK泊より多ければその分だけ一泊Y円
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
# K泊より多い場合はその分だけ単価Y円を掛ける
if N >= K:
    total_price = K * X + (N - K) * Y
# K泊より少ない場合は泊数に単価X円を掛ける
else:
    total_price = N * X

print(total_price)
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if(V<W):
    print("NO")
elif(abs(A-B)>T*(V-W)):
    print("NO")
else:
    print("YES")
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())

ans = "NG"
for i in range(a, b + 1):
    if i % k == 0:
        ans = "OK"
        break
print(ans)
# Judge status: Accepted
import math

n = int(input())
aL = list(map(int, input().split(" ")))

MOD = 10**9 + 7

aL2 = [aL[-1]]
for a in reversed(aL[:-1]):
    aL2.append((aL2[-1] + a) % MOD)
aL2 = list(reversed(aL2))

ans = 0
for i in range(n - 1):
    ans += aL[i] * aL2[i + 1]
    ans %= MOD

print(ans)
# Judge status: Accepted
n, m, x = map(int, input().split())
a = [[] for i in range(n)]
c = [0] * n
for i in range(n):
	c[i], *a[i] = map(int, input().split())
ans = 1e9
for mask in range(2 ** n):
	cost = 0
	b = [0] * m
	for i in range(n):
		if mask & (1 << i):
			cost += c[i]
			for j in range(m):
				b[j] += a[i][j]
	cnt = True
	for j in range(m):
		cnt &= b[j] >= x
	if cnt:
		ans = min(ans, cost)
			
if ans < 1e9:
	print(ans) 
else:
	print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
max_a = max(a)
del a[-1]
target = int(1e9+1)
for aa in a:
    if abs(max_a - target*2) >= abs(max_a - aa*2):
        target = aa
print(max_a, target)
# Judge status: Accepted
N,L = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
ans = "".join(S)
print(ans)
# Judge status: Wrong Answer
L, R = map(int, input().split())
 
L2 = L%2019
R2 = R%2019

if L2 == 0 or R2 == 0:
    print(0)
    exit()

if L + 2019 < R:
    print(0)
    exit() 
 
length = abs(R2-L2+1)
ans = []
for i in range(length):
    if L2 < R2:
        k = (L2+i) % 2019
        ans.append(k)
    elif L2 > R2:
        k = (R2+i) % 2019
        ans.append(k)
 
list.sort(ans)
print(ans)
print((ans[0]*ans[1])%2019)