peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def division(n):
    if n < 2:
        return [1]

    prime_factors = [1]

    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)

    return prime_factors

a,b = map(int,input().split())
da = set(division(a))
db = set(division(b))
cnt = 0
for i in da:
    if i in db:
        cnt += 1
print(cnt)
# Judge status: Accepted
c = [list(map(int, input().split())) for i in range(3)]
x = c[0][2]-c[0][1]
y = c[0][1]-c[0][0]
for i in range(1, 3):
    if c[i][1]-c[i][0] != y:
        print('No')
        break
    if c[i][2]-c[i][1] != x:
        print('No')
        break

else:
    print('Yes')
# Judge status: Accepted
X,Y=map(int,input().split())
print(X+(Y//2))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
for i in range(1,n):
    dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]))
    if i==1:
        continue
    dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]))
print(dp[-1])
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = [int(x)-1 for x in input().split()]

visited = [0] * n
visit_list = [0]
visit = 0
while True:
    visit_list.append(a[visit])
    visit = a[visit]
    if visited[visit] == 1:
        break
    visited[a[visit]] = 1

print(visit_list[k%len(visit_list)]+1)
# Judge status: Wrong Answer
s = input()
t = input()
l = []
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if s[i+j] != t[j] and s[i+j] != "?":
            break
    else:
        print(s[:i]+t+s[i+j+1:])
        l.append(s[:i]+t+s[i+j+1:])
if len(l) == 0:
    print("UNRESTORABLE")
    exit()
l.sort()
print(l[0].replace("?", "a"))
# Judge status: Wrong Answer
a,b,c,d = map(int, input().split())
if b*d>0: print(b*d)
else:
  if b<0:
    print(max(a,b)*min(c,d))
  elif d<0:
    print(min(a,b)*max(c,d))
  else:
    print(min(a,b)*min(c,d))
# Judge status: Wrong Answer
A,B=map(int,input().split())
if 1<A<10 and 1<B<10:
  print(A*B)
else:
  print(-1)
# Judge status: Accepted
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)

for i in range(m):
    largest = -heapq.heappop(a)
    largest = largest // 2
    heapq.heappush(a, -largest)

print(-sum(a))
# Judge status: Accepted
H, N = map(int, input().split())
A = list(map(int, input().split()))
if H > sum(sorted(A, reverse=True)[:N]):
  print('No')
else:
  print('Yes')
# Judge status: Accepted
K,S = map(int,input().split())
ans = 0
for k in range(K+1):
    ans += max(0, min(S - k, K) - max(0, S - k - K) + 1)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())
if b + c > a:
    print(b+c-a)
else:
    print(0)
# Judge status: Accepted
import bisect

N = int(input())
Alist = sorted(list(map(int, input().split())))
Blist = sorted(list(map(int, input().split())))
Clist = sorted(list(map(int, input().split())))

ans = 0

for B in Blist:
    Aindex = bisect.bisect_left(Alist, B)
    Cindex = bisect.bisect_right(Clist, B)

#    print(B, Aindex, N-Cindex)
    ans += Aindex * (N - Cindex)

print(ans)
# Judge status: Accepted
def split_sum(n):
    ans = 0
    while n:
        ans += n % 10
        n //= 10
    return ans


N = int(input())
ans = float('inf')
for A in range(1, N):
    B = N - A
    if A > B:
        break
    ans = min(ans, split_sum(A) + split_sum(B))
print(ans)
# Judge status: Accepted
from collections import Counter

def solve():
    N = int(input())
    D = list(map(int, input().split()))

    mod = 998244353

    if D[0] != 0:
        print(0)
        return

    cnt = Counter(D)

    if cnt[0] > 1:
        print(0)
        return

    res = 1

    for i in range(1, max(D)+1):
        if cnt[i-1] == 1:
            continue
        res *= cnt[i-1]**cnt[i] %mod
        res %= mod
    
    print(res)

solve()
# Judge status: Wrong Answer
K=int(input())
import math

if K==1:
  print(1)
  exit()
elif K==2:
  print(8)
  exit()
else:
  t=0
  for i in range(1,K-1):
    for j in range(i+1,K):
      for k in range(j+1,K+1):
        a=math.gcd(i,j)
        b=math.gcd(a,k)
        t+=b
  tw=0
  for i in range(1,K):
    for j in range(i+1,K+1):
      a=math.gcd(i,j)
      tw+=a
  
  on=0
  for i in range(1,K+1):
    on+=i
  print(t*6+tw*6+on)
# Judge status: Accepted
import sys
import numpy as np
import heapq


def input():
    return sys.stdin.readline()[:-1]


def solve():
    N, K = map(int, input().split())
    S = input()
    cnt = 2*K
    for i in range(N-1):
        if S[i] == S[i + 1]:
            cnt += 1
    print(min(N-1, cnt))


if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
N=int(input())
L=list(map(int,input().split()))
M=[float("inf")]*(N+10)
M[0]=0
for i in range(1,N+1):
	M[i]=M[i-1]+L[i-1]
ans=float("inf")
for i in range(N+1):
	X=M[i]
	Y=M[N]-M[i]
	ans=min(ans,abs(X-Y))
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()

ans=0
prev=['']*k
for i in range(n):
    if t[i]!=prev[i%k]:
        prev[i%k]=t[i]
        if t[i]=='r':
            ans+=p
        elif t[i]=='p':
            ans+=s
        elif t[i]=='s':
            ans+=r
    else:
        prev[i%k]=''
print(ans)
# Judge status: Wrong Answer
# ABC 064: C – Colorful Leaderboard
N = int(input())
a = [int(i) for i in input().split()]

colors = [0] * 8

for rate in a:
    if rate < 3200:
        colors[rate // 400] += 1

a_min = len([i for i in colors if i > 0]) if sum(colors) != 0 else 1
print(a_min, a_min + len([j for j in a if j >= 3200]))
# Judge status: Wrong Answer
a,b = map(int,input().split())
print(a*b)
# Judge status: Wrong Answer
N = int(input())
S = str(N)
if(len(S) == 1): print(S); exit(0)
for i in range(len(S)):
    if(int(S[i]) != 9):
        print(int(S[0]) - 1 + (len(S) - 1) * 9)
        exit(0)
print(len(S) * 9)
# Judge status: Wrong Answer
import math
a,b,k = map(int,input().split())

g = math.gcd(a,b)
c = 0
i = 1
for i in range(g,1,-1) :
    if g%i == 0 :
        c+=1
        if c==k :
            break
print(i)
# Judge status: Wrong Answer
R = int(input())
print (2*(3.141592653589793238)*R*R)
# Judge status: Accepted
N, K = map(int, input().split())

cnt = 1
while(True):
    if N // (K**cnt) < 1:
        break
    cnt += 1
print(cnt)
# Judge status: Accepted
n, k = map(int, input().split())
list_score = [ list(map(int,input().split(" "))) for i in range(n)]
list_score.sort(key=lambda x:x[0])
cnt = 0
ans = -1
for i in range(n):
    cnt += list_score[i][1]
    if cnt >= k:
        ans = list_score[i][0]
        break

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()

def main():
	n=II()
	A=[II() for _ in range(5)]
	print(5+(n-1)//min(A))









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

c = collections.Counter(a).most_common()
c.reverse()

first=0
second=0
for tmp in c:
    if tmp[1] >=4 and first*second==0:
        first=tmp[0]
        second=tmp[0]
        break
    if tmp[1] >=2:
        if first==0:
            first=tmp[0]
        else:
            second=tmp[0]
            break
print(first*second)
# Judge status: Accepted
import sys

n = int(sys.stdin.readline().rstrip())
*a, = map(int, sys.stdin.readline().split())
*b, = map(int, sys.stdin.readline().split())

def main():
    tot = 0
    for i in range(n):
        tot += min(b[i], a[i])
        b[i] = max(0, b[i] - a[i])
        tot += min(b[i], a[i+1])
        a[i+1] = max(0, a[i+1] - b[i])
    print(tot)
        
if __name__ ==  '__main__':
    main()
# Judge status: Wrong Answer
n,m=map(int,input().split())

if 2*n>=m:
    print(n)
else:
    res = n    #元の状態で作れる総数
    tmp = m-2*n  #残り
    res += tmp//4
    print(res)
# Judge status: Wrong Answer
N=int(input())
W=list(map(int,input().split()))
SUM=sum(W)
REST=0
MIN=100000
for i in range(N):
     REST=REST+W[i-1]
     SUM=SUM-REST
     if MIN >abs(SUM-REST):
         MIN=abs(SUM-REST)
print(MIN)
# Judge status: Accepted
import queue
n,m = map(int,input().split())
g = [[] for _ in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
q = queue.Queue()
q.put(0)
d = [-1]*n
d[0] = 0

while not q.empty():
    v = q.get()
    for i in g[v]:
        if d[i] != -1:
            continue
        d[i] = v
        q.put(i)
if -1 in d:
    print("No")
else:
    print("Yes")
    for i in d[1:]:
        print(i+1)
# Judge status: Accepted
x = input()
n = len(x)

stack=[]
ans = 1
for i in range(n):
    if(len(stack) > 0 and x[i] == 'T' and stack[-1] == 'S'):
        ans += 1
        stack.pop()
    else:
        stack.append(x[i])
    
print(len(stack))
# Judge status: Accepted
A = int(input())
B = int(input())
if A + B == 3:
  print(3)
elif A + B == 4:
  print(2)
elif A + B == 5:
  print(1)
# Judge status: Accepted
a,b,k = map(int,input().split())

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

a = []
b = []

for i in range(n):
    x = list(map(int, input().split()))
    a.append(x[0])
    b.append(x[1])

a_sort = sorted(a)
b_sort = sorted(b)

flags = [False] * n

s = 0

if n % 2 == 1:
    s = b_sort[n//2] - a_sort[n//2] + 1

else:
    p_min = a_sort[(n//2)-1]
    p_max = b_sort[(n//2)-1]
    q_min = a_sort[(n//2)]
    q_max = b_sort[(n//2)]

    s = ((p_max+q_max) - (p_min+q_min) ) + 1
print(s)
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
for x in range(1,n+1):
  for y in range(1,m+1):
    if (n-x)*y+(m-y)*x==k:
      print('Yes')
      exit()
print('No')
# Judge status: Wrong Answer
W,a,b = [int(i) for i in input().split()]
if a <= b and b <= a + W:
  print(0)
elif a + W < b:
  print(b-a-W)
elif b + W < a:
  print(a-b-W)
# Judge status: Wrong Answer
N = int(input())
result = []
for i in range(1, N + 1):
    count = 0
    flag = True
    while flag:
        i = i / 2
        if i % 2 == 0:
            count += 1
            continue
        else:
            result.append(count)
            flag = False
print(result.index(max(result))+1)
# Judge status: Accepted
y,m,d=map(int,input().split("/"))
if y<2019:
    print("Heisei")
elif y==2019 and m<=4:
        print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
x = int(input())
print(x // 500 * 1000 + x % 500 // 5 * 5)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    S = input()
    N = S[:A] + S[A + 1:]

    print("Yes" if S[A] == "-" and N.isdigit() else "No")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
l = list(map(int,input().split()))
l_ans = [[] for _ in range(201)]

for i in range(-100,101):
    sum = 0

    for j in range(N):
        sum = sum + (i-l[j])**2

    l_ans[i+100] = sum

print(l_ans)
print(min(l_ans))
# Judge status: Accepted
s = input()

n = len(s)
ok = False
ans = 9
if n == 1:
    print(s)
    exit()

for i in range(n-1):
    if ok:
        ans += 9
        continue
    if s[i+1] == '9':
        ans += ord(s[i]) - ord('0')
        continue
    x = ord(s[i]) - ord('0')
    ans += x-1
    ok = True

print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
hidari=-10**100
migi=10**100
keep=1
for i in range(m):
  l,r=map(int,input().split())
  if l>migi or r<hidari:
    keep=0
    break
  elif hidari<=l<=r<=migi:
    hidari=l
    migi=r
  elif l<=hidari<=migi<=r:
    pass
  elif l<=hidari<=r<=migi:
    migi=r
  elif hidari<=l<=migi<=r:
    hidari=l

if keep==1:
  res=migi-hidari+1       
  print(min(res,n))
else:
  print(0)
# Judge status: Accepted
N = int(input())
flag = 0
if N%4==0 or N%7==0:
    flag=1
    print("Yes")
else:
    for i in range(7,N,7):
        if (N-i)%4==0:
            flag=1
            print("Yes")
            break
if flag==0:
    print("No")
# Judge status: Accepted
N = int(input())
 
city = []
for i in range(N):
    s, p = input().split()
    city.append([s, int(p), i+1])
city.sort(key=lambda city: (city[0], -city[1]))
 
for i in city:
    print(i[2])
# Judge status: Wrong Answer
n = int(input())
l = [2,1]
if n>2:
    for i in range(n-1):
        l.append(l[i]+l[i+1])
print(l[-1])
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
m=min(a)

c=0
for i in reversed(range(1,m)):
    cnt=0
    for j in range(n):
        if a[j]%i==0:
            cnt+=1
    if cnt>=n-1:
        c=i
        break
print(c)
# Judge status: Accepted
from fractions import gcd

def lcm(a, b):
  return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
  ans = lcm(ans, int(input()))
print(ans)
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = list(map(int,input().split()))
m = len(bin(max(a)))-2
b = np.array([0]*m)
ans = 0
for i in range(n):
  b += np.array([(a[i] >> j) & 1 for j in range(m)])
for i in range(m):
  ans += ((2**i)*b[i]*(n-b[i]))%(10**9+7)
print(ans%(10**9+7))
# Judge status: Accepted
import numpy as np

a, b, h, m = [float(i) for i in input().split()]
kakua = 2*np.pi/12*h+2*np.pi/12*m/60
kakub = 2*np.pi/60*m
kaku = abs( kakua - kakub )
x = np.sqrt(a*a + b*b - 2*a*b*np.cos(kaku))
print(x)
# Judge status: Accepted
A, B = map(int, input().split())

def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
            
        while n % i == 0:
            res.add(i)
            n //= i
            
    if n != 1:
        res.add(n)
        
    return res

print(len(prime_factor(A) & prime_factor(B)))
# Judge status: Accepted
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

o = s()
e = s()

ans = ""
for i in range( len(o)+len(e) ):
	if i%2 == 0:
		ans += o[i//2]
	else:
		ans += e[i//2]
print(ans)
# Judge status: Accepted
a = input()
k = int(input())
count = 1
for i in a:
  if i != "1":
    break
  count += 1
if k >= count:
  print(a[count-1])
else:
  print("1")
# Judge status: Accepted
l=sorted([int(x) for x in input().split()],reverse=True)
k=int(input())

print((l[0]*2**k)+l[1]+l[2])
# Judge status: Accepted
s = list(input())
t = list(input())

s.sort()
t.sort(reverse = True)

s1 = ''.join(s)
t1 = ''.join(t)

if s < t :
    print("Yes")
else :
    print("No")
# Judge status: Wrong Answer
import math
a,b = map(int,input().split())
c = a*10+b
if c == (math.sqrt(c))**2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
for i in range(n,1000):
    a = str(i)
    if a[0] == a[1] and a[0] == a[2]:
        print(i)
        break
# Judge status: Accepted
w,a,b = map(int,input().split())
m = b-a-w
n = a-b-w
if m>0:
  print(m)
elif n>0:
  print(n)
else:
  print(0)
# Judge status: Accepted
# coding: utf-8
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()))
P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)
ans = 0
L = P[:X] + Q[:Y]
Rt = [False for _ in range(C)]
L.sort()
idx = 0
for i in range(X+Y):
    if idx >= C:
        break
    if L[i] < R[idx]:
        L[i] = R[idx]
        idx += 1
print(sum(L))
# Judge status: Accepted
from collections import deque

S = input()
dq = deque(S)

Q = int(input())
inverse = False
for _ in range(Q):
    query = list(input().split())
    if query[0] == '1':
        inverse = not inverse
    else:
        tmp = (int(query[1]) - 1) ^ inverse
        if tmp: dq.append(query[2])
        else: dq.appendleft(query[2])

if inverse: dq.reverse()
for c in dq:
    print(c, end='')
print('')
# Judge status: Accepted
x, y =map(int, input().split())
if x in {1,3,5,7,8,10,12}:
    x= 1
elif x in {4,6,9,11}:
    x =2
else:
    x = 3
if y in {1,3,5,7,8,10,12}:
    y= 1
elif y in {4,6,9,11}:
    y =2
else:
    y = 3
print("Yes" if x == y else "No")
# Judge status: Wrong Answer
N = int(input())
ans = 0
prev_A = -10
prev_card_num = 0
for i in range(1,N+1):
    A = int(input())
    ans += (prev_card_num + A)//2
    if prev_A == i-1 and (prev_card_num+A)%2 == 1:
        prev_card_num = 1
        prev_A = i
    elif prev_A == i-1 and (prev_card_num+A)%2 == 0:
        prev_card_num = 0
    else:
        prev_card_num = 1
        prev_A = i
print(ans)
# Judge status: Wrong Answer
input_list = input().split(" ")
[print(i+1) for i in range(len(input_list)) if input_list[i]!=i+1]
# Judge status: Accepted
def conta_casos(n, k):
    s = 0
    for i in range(k, n+2):
        s += i*(n-i+1)+1
    print(s % (1000000000+7))

a, b = [int(x) for x in input().split()]
conta_casos(a, b)
# Judge status: Accepted
def main():
    x = list(map(int, input().split()))
    r = x.index(0) + 1
    print(r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b = map(int, input().split())
print(-(-(a + b) // 2))
# Judge status: Accepted
N,M = map(int, input().split())
# tasks[i][j]
# i: 開始日
# j: 価値
tasks = [[] for _ in range(M)]
for _ in range(N):
    A,B = map(int, input().split())
    if A <= M:
        tasks[M - A].append(B)

from heapq import *

que = []
for day in range(M):
    for task in tasks[day]:
        if len(que) < day + 1:
            heappush(que, task)
        elif len(que) == day + 1:
            heappushpop(que, task)

print(sum(que))
# Judge status: Wrong Answer
N = list(map(int, input().split()))

if 9 in N:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
if n<3:
    print(n)
else:
    if n%2==1:
        print(n//2)
        print(n//2+1)
    else:
        print(n//2-1)
        print(n//2+1)
# Judge status: Wrong Answer
N = str(input())
if N[-1]==3:
  print('bon')
elif (N[-1]==0)or(N[-1]==1)or(N[-1]==6)or(N[-1]==8):
  print('pon')
else:
  print('hon')
# Judge status: Wrong Answer
import math

r=int(input())

cir = 2 * r * r * math.pi

print(cir)
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
H=[int(_) for _ in input().split()]
Tx=[]
for i in range(n):
    Tx.append([i+1,abs(a-t+H[i]*0.006)])
Tx.sort(key=lambda x:x[1])
print(Tx[0][0])
# Judge status: Accepted
N = int(input())
ans = N*(N+1)/2
print(int(ans))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
    
cnt = 0
for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
s = input()
count = 0
for i in range(len(s)):
    if s[i] != s[len(s)-i-1]:
        count +=1
print(count/2)
# Judge status: Wrong Answer
A,B,C = input().split()
print("A""B[0]""C")
# Judge status: Accepted
i = input()

a, b, c, d= i.split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)

while (a > 0) or (c > 0):
    c = c - b
    if (a < 1) or (c < 1):
        break
    a = a - d

if a < 1:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import math
x = int(input())

def lcm(a):
    return (x*360)//math.gcd(x,360)

if 360%x==0:
    print(int(360/x))

else:
    print(int(lcm(x)/x))
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))

def imos(n,a):
  imos_l=[0]*n
  for i in range(n):
    l=max(i-a[i],0)
    r=min(i+a[i],n-1)
    imos_l[l]+=1
    if (r+1)!=n:
      imos_l[r+1]-=1

  b=[0]
  for i in range(1,n+1):
    b.append(imos_l[i-1]+b[i-1])
  return b[1:]

for i in range(k):
  na=imos(n,a)
  if na==a:
    break
  a=na

print(*a)
# Judge status: Accepted
a = []
a = input().split()
K = int(a[0])
N = int(a[1])
#print('K=', K, 'N=', N)
A = []
A = input().split()
A = [int(i) for i in A]
#print('A=', A)

l = []

for i in range(len(A)-1):
  l.append(A[i+1] - A[i])
l.append(K - A[len(A)-1] + A[0])

#print('l=', l)

M = max(l)

#print('M=', M)

print(K - M)
# Judge status: Wrong Answer
inputs = [int(x) for x in input().split()]
a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

# Avoid using 0
if a == 0:
    a += 1
if b == 0:
    b -= 1
if c == 0:
    c += 1
if d == 0:
    d -= 1

if (a > 0 and b > 0 and c < 0 and d < 0) or (a < 0 and b < 0 and c > 0 and d > 0):
    # Return the max negative value
    print(-(min(abs(a), abs(b)) * min(abs(c), abs(d))))    
else:
    # Return the max positive value
    print(max(a * c, b * d))
# Judge status: Accepted
li = list(map(int,input().split()))
li.append(li[0]+li[1])
for i in range(3):
    if li[i] % 3 == 0:
        print("Possible")
        exit()
print("Impossible")
# Judge status: Wrong Answer
n,p=map(int,input().split())
a=list(map(int,input().split()))
print(2**(n-1))
# Judge status: Accepted
# coding: utf-8
N = int(input())
if N % 2 != 0:
    print(0)
    exit()

ans = N // 10
N //= 10
while N > 0:
    ans += N // 5
    N //= 5
print(ans)
# Judge status: Wrong Answer
X, Y = map(int, input().split())

print(X + Y/2)
# Judge status: Accepted
data = [int(input()), int(input())]

if not(1 in data):
  print(1)
elif not(2 in data):
  print(2)
elif not(3 in data):
  print(3)
# Judge status: Wrong Answer
N,X,Y=map(int,input().split())


def count(k):
    count=0
    for i in range(1,N):
        for j in range(i+1,N+1):
            if min(abs(j-i),abs(X-i)+abs(Y-j)+1)==k:
                count+=1
                if count >= 3:
                    break
    return count

for k in range(1,N):
    print(count(k))
# Judge status: Wrong Answer
l=list(map(int,input().split()))
if(l[1]-l[0]==l[2]-l[1]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N, K = map(int, input().split())
a = list(map(int,input().split()))

a_dict = {}

for i in range(N):
    if a[i] not in a_dict.keys():
        a_dict[a[i]] = 1
    else:
        a_dict[a[i]] += 1

ans = 0
if len(a_dict) <= K:
    print(ans)
else:
    sort_a_dict_list = sorted(a_dict.items(), reverse=True)
    for j in range(len(a_dict) - K):
        ans += sort_a_dict_list[j][1]
    print(ans)
# Judge status: Accepted
A, B = map(int, input().split())
print(-(-(B-A)//(A-1))+1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

s = a[0]
for num in a[1:]:
  s ^= num

res = [0] * n
for i, num in enumerate(a):
  res[i] = s ^ num

print(*res)
# Judge status: Accepted
from fractions import gcd


def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res


A, B = map(int, input().split())
g = gcd(A, B)
print(len(set(factor(g))) + 1)
# Judge status: Wrong Answer
a, b, c = list(map(int, input().split()))

print((a*b)/2)
# Judge status: Accepted
s=input()
stack=[2]
n=len(s)

cnt=0
for i in range(n):
  if s[i]=='0' and stack[-1]=='1':
    stack.pop()
    cnt+=2
  elif s[i]=='1' and stack[-1]=='0':
    stack.pop()
    cnt+=2
  else:
    stack.append(s[i])
print(cnt)
# Judge status: Accepted
import sys

N=int(sys.stdin.readline())

A=[int(i) for i in sys.stdin.readline().split()]

ans=[0]*N

total=0

for x in range(N):
	total^=A[x]

for y in range(N):
	ans[y]=str(total^A[y])

print(" ".join(ans))
# Judge status: Accepted
def main():
    a = [input() for _ in range(int(input()))]
    common = ""
    for x in "abcdefghijklmnopqrstuvwxyz":
        common += x * min((i.count(x) for i in a))
    print(common)
        
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import sys
X = int(input())

i, j = 0, 0
for b in range(1, 1000):
    for z in range(1, 1000):
        if b**4 + 10*b**3*z + 10*b**2*z**2 + 5*b*z**3 + z**4 == X//z:
            print(b+z, b)
            sys.exit()
# Judge status: Wrong Answer
n = int(input())
alist = list(map(int,input().split()))

alist = sorted(alist,reverse=True)

ans = 0
for i in range(n-1):
    ans += alist[i]

print(ans)