peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N<=K:
    ans = int(X*N)
    
else:
    ans = int(X*K + Y*(N-K))
    
print(int(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
# input
a = int(input())
if a % 11 == 0:
    print(int((a//11)*2))
elif a % 11 <= 6:
    print(int((a//11)*2+1))
elif a % 11 > 6:
    print(int((a//11)*2+2))
# Judge status: Accepted
c = input()
boin = ["a","e","i","o","u"]
print("vowel" if c in boin else "consonant")
# Judge status: Accepted
m = list(map(int,input().split(" ")))
W = m[0]
H = m[1]
x = m[2]
y = m[3]

xyplus = x + y
#重心に来る時は複数、線上と内部は1こ
# if w % 2 == 0 and h % 2 == 0:

ans_area = W * H / 2
if x == W / 2 and y == H / 2:
    ans_sp = 1
else:
    ans_sp = 0
print(str(ans_area) + " " + str(ans_sp))
# Judge status: Wrong Answer
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

hand = {'r':p, 's':r, 'p':s}
win = {'r':'p', 's':'r', 'p':'s'}

ans = 0
u = []
for i,tt in enumerate(t):
    if i >= k and u[i-k] == win[tt]:
            u.append(tt)
    else:
        u.append(win[tt])
        ans += hand[tt]
print(ans)
# Judge status: Accepted
K=int(input())
if K%2==0 or K%5==0:
    print('-1')
    exit()
a=0
i=1
while True:
    a=(a*10+7)%K
    if a==0:
        print(i)
        break
    i+=1
# Judge status: Accepted
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  k,x = map(int,input().split())
  P = []
  
  for i in range(x-k+1,x+k):
    P.append(i)
  
  print(*P)
  
  
if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
import sys
N,X = map(int,input().split())
L = [el for el in map(int,input().split())]
L.append(X)
L.sort()
q = 0
if N == 1:
  print(L[0]-X)
  sys.exit(0)
for p in range(L[0]+1,0,-1):
  q = 0
  for j in range(0,len(L)):
    if L[j] % p != L[0] % p:
      q = 1
      break
  if q == 0:
    print(p)
    break
# Judge status: Accepted
import sys
n,m=map(int,input().split())
tmp=[-1]*n
for _ in range(m):
    s,c=map(int,input().split())
    s-=1
    if tmp[s]<0:
        tmp[s]=c
    if tmp[s]!=c:
        print(-1)
        sys.exit()
if tmp[0]==0 and n>1:
    print(-1)
    sys.exit()
if tmp[0]<0 and n>1:
    tmp[0]=1
if n==1 and tmp[0]==-1:
    tmp[0]=0
for i in range(1,n):
    if tmp[i]<0:
        tmp[i]=0
for i in tmp:
    print(i,end='')
# Judge status: Wrong Answer
C = input()

dic = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}

keys = list(dic.keys())

for i in range(26):
    if keys[i]==C:
        print(keys[i+1])
        break
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
for i in range(N):
    ans += A[i] // 2
    A[i] %= 2
    if N == 1 and i < N-1 and A[i+1] > 0:
        A[i+1] -= 1
        ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
s = [int(input()) for i in range(N)]

if all(i%10 == 0 for i in s):
    print(0)
    exit()

elif sum(s)%10 != 0:
    print(sum(s))
    exit()

test = []
s = sorted(s)
for i in s:
    test.append(i)

for i in range(N):
    test[i] = 0
    if sum(test)%10 != 0:
        print(sum(test))
        exit()
    else:
        test[i] = s[i]
# Judge status: Accepted
from collections import deque
N = int(input())
tmp = N
ans = deque()
while tmp != 0:
  r = tmp % 2
  ans.appendleft(r)
  tmp = (tmp-r)//(-2)
print(0 if N == 0 else "".join([str(a) for a in ans]))
# Judge status: Accepted
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))
a,v=l_in()
b,w=l_in()
t=n_in()

if b > a:
    if b + w*t <= a + v*t:
        print("YES")
    else:
        print("NO")
elif a > b:
    if b - w*t >= a - v*t:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
# Judge status: Accepted
s = list(input())
t = list(input())
ss = "".join(sorted(s))
tt = "".join(sorted(t, reverse=True))
flag = False
if ss < tt:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
X, Y, a, b, c = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
s = sorted(p)[::-1][:X] + sorted(q)[::-1][:X] + r
ans = sum(s[:X + Y])
print(ans)
# Judge status: Accepted
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
A = A1 + A2 + A3
N = int(input())
s = set() # index of A
for _ in range(N):
  b = int(input())
  if b in A:
    s |= {A.index(b)}
# bingo index
bingo = [{0, 1, 2}, {0, 3, 6}, {0, 4, 8}, {1, 4, 7}, {2, 4, 6}, {2, 5, 8}, {3, 4, 5}, {6, 7, 8}]
print(['No','Yes'][any(b <= s for b in bingo)])
# Judge status: Wrong Answer
N,K=map(int,input().split())
print(K*(2*N+1-2*K)/2)
# Judge status: Accepted
import math
n, k = list(map(int, input().split()))
if n == 1:
    print(1)
else:
    print(math.ceil(math.log(n, k)))
# Judge status: Accepted
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

A, B, C = lr()
time = B // A
answer = min(C, time)
print(answer)
# Judge status: Accepted
def howmanytwo(m):
  ret=0
  while m%2==0:
    ret+=1
    m=m//2
  return ret

N=int(input())
A=[int(i) for i in input().split()]
evn=[howmanytwo(a) for a in A]
od=evn.count(0)
evev=0
for x in evn:
  if x>=2:
    evev+=1
if od+evev!=N:
  evev+=1
else:
  evev+=2
print('Yes' if od+1<=evev else 'No')
# Judge status: Wrong Answer

X = input()
s = 0
t = 0
for i in range(len(X)):
    if X[i] == 'S':
        t = i
        break
for i in range(len(X)):
    j = len(X) - i - 1
    if X[len(X)-i-1] == 'T':
        s = j
        break
ans = len(X) - min(X[:s].count('S'), X[t:].count('T')) * 2
print(ans)
# Judge status: Accepted
#=============================================================================
# ABC133 B
#=============================================================================
import itertools
import math
N,D=map(int,input().split())
id=[i for i in range(N)]
point=[list(map(int,input().split())) for _ in range(N)]
comb=itertools.combinations(id,2)
cnt=0
for p,q in comb:
    Squ=0
    for k in range(D):
        Squ+=(point[p][k]-point[q][k])**2
    if math.ceil(Squ**0.5)==Squ**0.5:
        cnt+=1
print(cnt)
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
if b-a<0:
  print('delicious')
elif b-a>0:
  if b-a<x:
    print('safe')
  else:
    print('dangerous')
# Judge status: Wrong Answer
S = input()
if S.count("R") == 0 and S.count("L") == 0:
	print("Yes")
elif S.count("R") > 0 and S.count("L") > 0:
	if S.index("R") % 2 == 0 and S.index("L") % 2 == 1:
		print("Yes")
	else:
		print("No")
elif S.count("R") > 0:
	if S.index("R") % 2 == 0:
		print("Yes")
	else:
		print("No")
else:
	if S.index("L") % 2 == 1:
		print("Yes")
	else:
		print("No")
# Judge status: Accepted
from collections import defaultdict

a = int(input())


d=defaultdict(int)
# d={}

for _ in range(a):
     b = input()
     c = "".join(sorted(b))
     d[c] +=1
    #  if d.get(c) == None: d[c] = 0
    #  else: d[c] +=1

sum=0
for v in d.values():
    sum+= (v*(v-1))//2


print(sum)
# Judge status: Accepted
from math import floor

A, B, N = list(map(int, input().split()))
# print(A, B, N)

x = None
if N < B:
    x = N
else:
    x = B
    x = B - 1
    # max_diff = 0
    # for _x in range(B, N + 1):
    #     diff = (x / B) - floor(x / B)
    #     if max_diff <= diff:
    #         max_diff = diff
    #         x = _x

answer = floor(A * x / B) - A * floor(x / B)

print(answer)
# Judge status: Accepted
S = input().strip()
print("x"*len(S))
# Judge status: Accepted
N = int(input())
l = {}
for i in range(N):
  s = input()
  s = ''.join(sorted(s))
  if s in l:
    l[s] += 1
  else:
    l[s] = 0
ans = 0
value_l = [1]
for value in l.values():
  if value == 0:
    continue
  if len(value_l) >= value:
    tmp = value_l[value - 1]
  else:
    l_val = len(value_l)
    for i in range(l_val, value):
      value_l.append(value_l[i-1] + i + 1)
    tmp = value_l[value - 1]
  ans += tmp

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N,H = map(int,input().split())
A = [0]*N
B = [0]*N
for i in range(N):
  A[i], B[i] = map(int,input().split())
B.sort()
ma = max(A)
from bisect import bisect_left, bisect_right
r = bisect_right(B, ma) # 5が入るべき境目のうち最も右側の境目を返す
C = B[r:]
ans = 0
for i in range(len(C)-1,-1,-1):
  H -= C[i]
  ans +=1
  if H<= 0:
    break
if H>0:
  ans += H//ma
  if H%ma!=0:
    ans+=1
print(ans)
# Judge status: Accepted
A, B = map(int, input().split(' '))
for i in range(1, 1010):
    if i * 8 // 100 == A and i * 10 // 100 == B:
        print(i)
        break
else:
    print(-1)
# Judge status: Accepted
ranges = [range(10), range(10, 100), range(100, 1000)]

N, M = map(int, input().split())
s = [0 for i in range(M)]
c = [0 for i in range(M)]
for i in range(M):
    s[i], c[i] = map(int, input().split())

ans = 0
found = False
for candidate in ranges[N - 1]:
    valid = True
    for i in range(M):
        if not (str(candidate)[s[i] - 1] == str(c[i])):
            valid = False
            break
    if valid:
        print(candidate)
        found = True
        break
if not found:
    print(-1)
# Judge status: Accepted
'''
Created on 2020/08/25

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,K=map(int,pin().split())
  D=list(map(int,pin().split()))
#   l=[0,1,2,3,4,5,6,7,8,9]
#   for i in D:
#     l.remove(i)
  j=N
  while True:
    for k in str(j):
      if int(k) in D:
        break
    else:
      print(j)
      break
    j+=1
  return 
main()
# Judge status: Accepted
def main():
    x, y = map(int, input().split())
    ans = 0
    while x <= y:
        x *= 2
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import queue
num=int(input())
q=queue.Queue()
for i in range(1,10):
  q.put(i)
for j in range(num):
  ans=q.get()
  if ans%10!=0:
    q.put(10*ans+(ans%10)-1)
  q.put(10*ans+(ans%10))
  if ans%10!=0:
    q.put(10*ans+(ans%10)+1)
print(ans)
# Judge status: Wrong Answer
# coding:utf-8
ab=0
ba=0
a,b=map(int,input().split())

ab=str(str(a)*b)
ba=str(str(b)*a)
l=[ab,ba]
sorted(l)
print(l[1])
# Judge status: Wrong Answer
N = int(input())
p = list(map(int, input().split()))
ans = 1
if N == 1:
    exit()
for i in range(1,N-1):
    if p[i]>p[i+1]:
        ans +=1
print(ans)
# Judge status: Accepted
N,A,B=[int(a) for a in input().split()]

div,mod=divmod(N,A+B)
ans=div*A + min(A,mod)
print(ans)
# Judge status: Accepted
A = list(map(int,input().split()))
A = sorted(A)
cnt = 0

if A[1]-A[0]>=2:
  cnt += (A[1]-A[0])//2
  A[0]+= cnt*2

if A[0]==A[1] and A[1]==A[2]:
  print(cnt)
  exit()

  
while(True):
  cnt+=1
  A = sorted(A)
  A[0]+=1
  A[1]+=1
  #print(A)
  if A[0]==A[1] and A[1]==A[2]:
    break

print(cnt)
# Judge status: Accepted
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

In = int(input())
count = 0
for i in range(1,In+1,2):
    if len(make_divisors(i))==8:
        count+=1

print(count)
# Judge status: Accepted
import sys
k = int(input())

a = [0]*k
a[0] = 7 % k

for i in range(1, k):
    a[i] = (10*a[i-1]+7) % k

for i in range(k):
    if a[i] == 0:
        print(i+1)
        sys.exit()
print(-1)
# Judge status: Wrong Answer
import numpy as np

up_ = np.array(list(reversed(input())))
lo = np.array(list(input()))

if (up_ == lo).all():
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import itertools, math

n = int(input())
point = [tuple(map(int, input().split())) for i in range(n)]

numbers = 1
for i in range(1,n+1):
    numbers *= i
print(numbers)
#nの階乗

route = list(itertools.permutations(point))

d = 0

for pattern in route:
    for i in range(n-1):
        d += math.sqrt((pattern[i][0]-pattern[i+1][0])**2 + (pattern[i][1]-pattern[i+1][1])**2)
        

ans = d / numbers

print(ans)
# Judge status: Accepted
a = [int(input()) for i in range(3)]
ans = ((a[0]+a[1]) * a[2]) / 2

print(str(int(ans)))
# Judge status: Accepted
from collections import Counter

N = int(input())
D = list(map(int, input().split()))
MOD = 998244353

c = Counter(D)
tmp = 1
ans = 1
zero_flg = False

for dist in range(N):
    if dist == 0 and (c[0] != 1 or D[0] != 0):
        print(0)
        exit()
    elif c[dist] == 0:
        zero_flg = True
    elif c[dist] > 0 and zero_flg:
        print(0)
        exit()
    else:
        ans *= pow(tmp, c[dist], MOD)
        ans %= MOD
        tmp = c[dist]

print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
for i in range(1, 10001):
    x=(i*8)//100
    y=(i*10)//100
    if x==A and y==B:
        print(i)
        break
else:
    print(-1)
# Judge status: Accepted
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

a = s()
t = s()

a = sorted(a)
y = "".join(a)
t = sorted(t,reverse = True)
x = "".join(t)
if y < x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
d = [0]*N
for i in reversed(range(1,N+1)):
    n=1
    t=0
    while i*n<=N:
        t+=d[i*n-1]
        n+=1
    d[i-1]=(t+A[i-1])%2
res = [i+1 for i,x in enumerate(d) if x]
print(len(res))
print(*res)
# Judge status: Wrong Answer
_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::2]) - sum(a[-2::2]))
# Judge status: Wrong Answer
s=list(input())	
a=0
b=0
if ("N" in s)&("S" in s):
  a=1
if ("W" in s)&("E" in s):
  b=1
if a&b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
x = int(input())
print("1" if x == 0 else "0")
# Judge status: Accepted
def f(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1
s = int(input())
A = [s]
for i in range(2, 1000001):
    A.append(f(A[-1]))
    if len(A) != len(set(A)):
        print(i)
        exit(0)
# Judge status: Accepted
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s = list(Counter(s).items())
m = int(input())
t = [input() for _ in range(m)]
t = Counter(t)

result = 0
for i in range(len(s)):
    result = max(s[i][1]-t[s[i][0]], result)
print(result)
# Judge status: Wrong Answer
H, A = list(map(int, input().split()))
print(H // A + 1)
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys
# input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

def main():
    X = input()

    LENX = len(X)

    S = 0

    for i in range(LENX//2):
        if X[i] == "S":
            S += 1
    
    print(LENX-2*S)

    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
a=int(input())
input()
input()
input()
e=int(input())
k=int(input())
print("Yay!" if k>=e-a else ":(")
# Judge status: Wrong Answer
n, k = map(int, input().split())

a = []

s = 0
for i in range(k):
  d = int(input())
  array = list(map(int, input().strip().split()))
  a.append(array)
for j in range(1, n):
  if k not in a:
    s += 1
print(s)
# Judge status: Accepted
import sys
input = sys.stdin.readline

import heapq
N,M = (int(x) for x in input().split())
jobs = [[] for i in range(M)]
count = 0
h = []
for i in range(N):
    A,B = (int(x) for x in input().split())
    if A <= M:
        jobs[A-1].append(B*(-1))
heapq.heapify(h)
for i in range(M):
    if jobs[i]:
        for job in jobs[i]:
            heapq.heappush(h,job)
    if h:
        count -= heapq.heappop(h)
print(count)
# Judge status: Accepted
# coding: utf-8


s = input().rstrip()

a_index = -1
b_index = -1

for i in range(len(s)):
    if s[i] == "A":
        if a_index < 0:
            a_index = i
    elif s[i] == "Z":
        b_index = i

print(b_index-a_index+1)
# Judge status: Accepted
a=input()
if str.isupper(a)==True:
    print("A")
else:
    print("a")
# Judge status: Accepted
S = input()

lst = []

lst.append(S.count("a"))
lst.append(S.count("b"))
lst.append(S.count("c"))

lst.sort()

if lst[0] + 1 >= lst[2]:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
N = int(input())
values_list = []
for i in range(N):
    values = list(map(int, input().split()))
    values_list.append(values)

# DPテーブルは選択分拡張する
dp = [[0,0,0] for i in range(N+1)]

for i in range(N):
    for j in range(0, 3):
        for k in range(0, 3):
            if j == k:
                continue
            dp[i][k] = max(dp[i][k], dp[i-1][j] + values_list[i][k])

print(dp)
print(max(dp[N-1]))
# Judge status: Accepted
n = int(input())

l = []
for i in range(n):
    l.append(input())
    
l_sorted  = sorted(set(l[0]))
ans=""

for k in l_sorted:
    cnt = min(l[i].count(k) for i in range(n))
    ans += k*cnt
print(ans)
# Judge status: Accepted
n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

base = n // 1.08
cands = [base-1, base, base+1]
flag = False
for cand in cands:
    if cand * 1.08 >= n and n > cand * 1.08 - 1:
        print(int(cand))
        flag = True
        break

if not flag:
    print(':(')
# Judge status: Accepted
n = int(input())
res = 0
for i in range(1, n):
    res += (n-1)//i
print(res)
# Judge status: Accepted
n,k = [int(x) for x in input().split(' ')]
 
def solve(n, k):
    snukes = [None] * n
    victims = 0
    
    for i in range(k):
        snacks = int(input())
        snukes_snacks = [int(z) for z in input().split(' ')]
        for j in range(snacks):
            snukes[snukes_snacks[j] - 1] = snukes_snacks[j]
    
    for w in range(n):
        if snukes[w] is None:
            victims += 1
    
    print(victims)
 
solve(n, k)
# Judge status: Wrong Answer
def resolve():
    n = int(input().replace(" ", ""))
    squares = [i**2 for i in range(1, 101)]
    print("Yes" if n in squares else "No")


if '__main__' == __name__:
    resolve()
# Judge status: Wrong Answer
n,k=map(int,input().split())
def po(a,t,p):
    bi=str(format(t,"b"))
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
          res=(res*a) %p
    return res
print(po(2,n+1,1000000007)-po(2,k-1,1000000007))
# Judge status: Accepted
A, B, C = list(map(int, input().split()))
cookies = set()
cookies.add((A, B, C))

a = A
b = B
c = C

count = 0
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    count += 1
    a = a // 2
    b = b // 2
    c = c // 2
    
    a2 = b + c
    b2 = a + c
    c2 = b + c
    if (a2, b2, c2) in cookies:
        count = -1
        break
    a = a2
    b = b2
    c = c2
    cookies.add((a, b, c))
print(count)
# Judge status: Wrong Answer
n,c,k = map(int, input().split())
l=[int(input()) for x in range(n)]
l.sort()
flg=0
bus=0
capa=0
for i in range(n):
    if capa<c:
        if l[i]<=flg+k:
            capa+=1
        else:
            bus+=1
            flg=l[i]
            capa=0
    elif capa==c:
        bus+=1
        capa=0
    
print(bus+1)
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())
print(a+b+c+max(a,b,c)*((2**k)-1))
# Judge status: Wrong Answer
S=input()
T=input()
match=0
for i in range(len(S)-len(T)):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)
# Judge status: Wrong Answer
N = int(input())
array = list(map(int, input().strip().split()))
count = int(0)
flag = int(0)
for x in range(N):
    if array[x] % 2 == 0:
        count += 1
        if array[x] % 3 == 0 or array[x] % 5 == 0:
            print('APPROVED')
            flag = 1
            break
if flag == 0:
    if count == N - 1:
        print('APPROVED')
        flag = 1
if flag == 0:
    print('DENIED')
# Judge status: Accepted
N=int(input())
A=[int(i) for i in input().split()]
A.sort()
cnt={}
K=list(set(A))
K.sort()
for k in K:
  cnt[k]=0
for a in A:
  cnt[a]+=1
E=[]
for k in K:
  if cnt[k]>=2:
    if cnt[k]>=4:
      E.append(k)
    E.append(k)
E.sort()
# print(E)
if len(E)>=2:
  print(E[-1]*E[-2])
else:
  print(0)
# Judge status: Accepted
n,l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
for i in sorted(s):
    print(i,end="")
# Judge status: Accepted
from collections import Counter

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

cnt = Counter(A)

for _ in range(M):
    b, c = map(int, input().split())
    cnt[c] += b

ans = 0
for b, c in sorted(cnt.items(), reverse=True):
    ans += min(c, N) * b
    N -= min(c, N)
    if N == 0:
        break
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
count=0
for i in range(k,n+2):
    count+=i*(n-i+1)+1
print(count%(10**9+7))
# Judge status: Accepted
#C
n = int(input())
p = list(map(int, input().split()))
n = p[0]
ans = 1
for i, z in enumerate(p):
    if i == 0:
        continue
    if z <= n:
        ans += 1
    n = min(n, z)
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0

while True:
  if[i for i in a if i%2==1]:
    break
  a=[i/2 for i in a]
  ans+=1
print(ans)
# Judge status: Accepted
S = int(input())
mod = 10**9+7

ans = 0

x = [0]*(2020)
x[3] = 1
x[4] = 1
x[5] = 1
for i in range(6, S+1):
    x[i] += 1
    for j in range(3, i-2):
        x[i] += x[j]
        x[i] %= mod

print(x[S])
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(x: "List[int]"):
    return x.index(0) + 1

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    x = [int(next(tokens)) for _ in range(5)]  # type: "List[int]"
    print(solve(x))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()
# Judge status: Accepted
B = [input() for i in range(int(input()))]
R = [input() for i in range(int(input()))]
B_dict = {}

for i in B:
    if i in B_dict:
        B_dict[i] += 1
    else:
        B_dict[i] = 1

max = 0
for item in B_dict:
    b_value = B_dict[item]
    r_value = R.count(item)
    if b_value - r_value > max:
        max = b_value - r_value

print(max)
# Judge status: Wrong Answer
n=int(input())
a=1

for i in range(1,n):
            if i**2>n:
                        break
            a==i**2
                               
print(a)
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())

print(a - max(0, (k - a - b)))
# Judge status: Accepted
s = input()
cnt = 0
for i in range(len(s)//2):
    if s[i] != s[-i -1]:
        cnt += 1
print(cnt)
# Judge status: Accepted
N, S = input(), input()
x, xmax = 0, 0
for s in S:
    x = (lambda a:x+1 if a=='I' else x-1)(s)
    xmax = max(x,xmax)
print(xmax)
# Judge status: Accepted
A,B,C = map(int, input().split())
print('{} {} {}'.format(C,A,B))
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
s = str(input())
d = Counter(s)
S = list(set(s))
l = len(S)
ans = 0
for i in range(2**l):
    L = [0] * l
    for j in range(l):
        if ((i >> j) & 1):
            L[j] = 1
    tmp = 0
    for k in range(l):
        if L[k] != 0:
            if tmp == 0:
                tmp = 1
            tmp *= d[S[k]]
    ans += tmp
print(ans)
# Judge status: Wrong Answer
x = input()

x = x.replace("ST", "")
ans = len(x)
s = 0
t = 0
f = 1
for xi in x:
    if f and xi == "S":
        if f:
            s += 1
        else:
            ans -= min(s, t) * 2
            s = 1
            t = 0
            f = 1
    if s and xi == "T":
        t += 1
        f = 0

ans -= min(s, t) * 2

print(ans)