peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S=input()
ans = 0
prev = ''
temp = ''
for c in S:
    temp += c
    if temp != prev:
        ans += 1
        prev = temp
        temp = ''

print(ans)
# Judge status: Accepted
n = int(input()) - 1
print(n*(n+1)//2)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
A = set(A)

mod = 1000000007

dp = [0] * (N + 1)

if len(dp) <= 2:
  print(1)

dp[-1] = 1
dp[-2] = 1 if N - 1 not in A else 0

for i in range(N-2, -1, -1):
  if i not in A:
    dp[i] = dp[i+1] + dp[i+2]

print(dp[0] % mod)
# Judge status: Wrong Answer
import sys


input = sys.stdin.readline

def resolve():
    S, T = map(str, input().split())
    A, B = map(int, input().split())
    U = input()

    if S == U:
        A -= 1
        print(str(A) + ' ' + str(B))
        return
    B -= 1
    print(str(A) + ' ' + str(B))


resolve()
# Judge status: Accepted
from collections import Counter
N = int(input())
d = Counter(map(int, input().split()))
for i in range(1, N+1):
    print(d[i])
# Judge status: Accepted
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
S = [0]*N
for i in A:
  S[i-1] += 1
for i in range(N):
  if Q-S[i] < K:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
H, N = map(int, input().split())
A = map(int, input().split())

if sum(A) >= H:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,M  = map(int, input().split())
# N : Sの数
# M : Cの数

if M <= 2*N: #Cの数が少ない
    print(N)
else:
    cnt = N
    M -= 2*N
    print(cnt+M//4)
# Judge status: Accepted
f = True
n,m=map(int,input().split())
number = [-1 for i in range(n)]
for i in range(m):
  s,c=list(map(int,input().split()))
  s -= 1
  if s == 0 and c == 0 and n > 1:
    f = False
  elif number[s] == -1 or number[s] == c:
    number[s] = c
  else:
    f = False
if not f:
  print(-1)
elif n == 1:
  if number[0] == -1:
    print(0)
  else:
    print(number[0])
else:
  if number[0] == -1:
    number[0] = 1
  for i in range(1,n):
    if number[i] == -1:
      number[i] = 0
  print(''.join(map(str,number)))
# Judge status: Accepted
str = input()
alpha = [chr(i) for i in range(ord('a'), ord('z')+1)]
ans = "None"
for id in alpha:
    if id not in str: 
        ans = id
        break
print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split())
if a>x or (a+b)<x:
  print('NO')
else:
  print('YES')
# Judge status: Accepted
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

dic = Counter(a)

l = []
for i, j in dic.items():
    if j >= 4:
        l.append(i)
        l.append(i)
    elif j >= 2:
        l.append(i)

if len(l) < 2:
    print(0)
else:
    l.sort()
    print(l[-1] * l[-2])
# Judge status: Accepted
X, Y = map(int, input().split())
twoLine = [2 ** (i) for i in range(61)]
for i in range(len(twoLine)):
    if X * twoLine[i] > Y:
        print(i)
        exit()
# Judge status: Accepted
import math
A, B = map(int, input().split())
print(math.ceil((B - A) / (A - 1)) + 1)
# Judge status: Accepted
k = "a",
for _ in range(int(input()) - 1):
  k = {a + b for a in k for b in a + chr(ord(max(a)) + 1)}
print(*sorted(k), sep='\n')
# Judge status: Accepted
a,b=map(int,input().split())
A=[]
c=1
for i in range(2,1001):
    A.append(c)
    c+=i
d=b-a
print(A[d-2]-a)
# Judge status: Wrong Answer
import sys
import math
import bisect

def solve(s):
    n = len(s)
    max_val = 0
    for i in range(1, n):
        s1 = set(list(s[0:i]))
        s2 = set(list(s[i:]))
        val = len(s1 ^ s2)
        max_val = max(max_val, val)
    return max_val

def main():
    n = int(input())
    s = input()
    print(solve(s))

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
sum_w = sum(w)
total = 0
ans = 1000
for i in range(n):
    total += w[i]
    ans = min(ans, abs(sum_w - 2 * total))
print(ans)
# Judge status: Accepted
a,b,t = map(int,input().split())
x = 0
for i in range(100):
    if a * i <= t: x = i
print(x * b)
# Judge status: Accepted
n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if abs(t-temp)>=abs(x-xtemp)+abs(y-ytemp) and (x-xtemp+y-ytemp-(t-temp))%2==0:
        count=count+1
    temp=t
    xtemp=x
    ytemp=y
if count==n:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b = map(int, input().split())
height_a = 0
height_b = 0

for i in range(999):
  height_a += i
  if a < height_a:
    break
  
for i in range(999):
  height_b += i
  if b < height_b:
    break

print(height_b - b)
# Judge status: Wrong Answer
n = int(input())
arr = list(map(int, input().split()))

for _ in range(n - 1):
    arr.sort()
    new_v = (arr[0] + arr[1]) / 2
    del arr[0:2]
    arr.append(new_v)

print(int(arr[0]))
# Judge status: Wrong Answer
def main():
    x=int(input())
    s=2*(x//11)+1
    print(s if 0<x%11<6 else s+1)
main()
# Judge status: Accepted
# https://atcoder.jp/contests/nikkei2019-2-qual/tasks/nikkei2019_2_qual_b
# まず、本当に木を構築するモノではないだろう
from collections import Counter
n = int(input())
nums = [int(i) for i in input().split()]
mod = 998244353
MAX = max(nums)

c = Counter(nums)
if nums[0] != 0 or nums.count(0) != 1:
    ans = 0
else:
    ans = 1
    for i in range(1, MAX + 1):
        ans = ans * pow(c.get(i - 1, 0), c.get(i, 0), mod) % mod
    ans %= mod
print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
A = sorted(map(int, input().split()), reverse=False)
m = max(A)+1
c = Counter(A)
s = list(set(A))
dp = [True] * m
for x in list(set(A)):
    t = x * 2
    while t < m:
        dp[t] = False
        t += x
ans = 0
for a in A:
    if c[a] == 1 and dp[a]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())

S = N*(N+1)/2

print(S)
# Judge status: Wrong Answer
n = int(input())

if n >= n % 15 == 0:
    x = n * 800
    y = 200 * n / 15
    answer = x - y
    print(answer)
else:
    answer = n * 800
    print(answer)
# Judge status: Accepted
(a,b) = map(int,input().split())
print(a*b)
# Judge status: Accepted
S = input()
T = input()
cnt = 0
for s, t in zip(S, T):
    if s != t:
        cnt += 1
print(cnt)
# Judge status: Accepted
n, m, X, Y = map(int, input().split())
x = max(list(map(int, input().split())))
y = min(list(map(int, input().split())))

if x >= y or X >= y or X >= Y or Y <= x:
    ans = "War"
else:
    ans = "No War"

print(ans)
# Judge status: Wrong Answer
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

i = 0
for s in range(n+m):
    if i>k:
        if a[0]>=b[0]:
            i = i + a[0]
            del a[0]
        else:
            i = i + b[0]
            del a[0]
    elif i==k:
        print(s+1)
    else:
        print(s)
# Judge status: Accepted
H1,M1,H2,M2,K=map(int,input().split())
print((H2-H1)*60+(M2-M1)-K)
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    x, y, a, b, c = map(int, input().split())
    p = map(int, input().split())
    q = map(int, input().split())
    r = map(int, input().split())
    p = list(reversed(sorted(p)))[:x]
    q = list(reversed(sorted(q)))[:y]
    pq = sorted(p + q)
    r = list(reversed(sorted(r)))
    for i in range(min(len(pq), len(r))):
        pq[i] = max(pq[i], r[i])
    print(sum(pq))

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

ans = S
cnt = 0
now = ""
for s in S:
    now = s
    if s == "(":
        cnt += 1
    elif s == ")":
        cnt -= 1
    if cnt == -1:
        ans = "(" + ans
        cnt = 0
if cnt > 0:
    ans = ans + ")"*cnt

print(ans)
# Judge status: Wrong Answer
(a,b,x) = map(int,input().split())
if a==0:
    print(int(b/x)+1)
else:
    print(int(b/x)-int((a-1)/x))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a == b == c:
    print(-1)
    exit()

cnt = 0
while (a % 2 == 0 and b % 2 == 0 and c % 2 == 0): 
    a, b, c = (b+c)//2, (a+c)//2, (a+b)//2
    cnt += 1

print(cnt)
# Judge status: Accepted
s=list(input())
l=len(s)
a=len(set(s))
if a==l:
	print('yes')
else:
	print('no')
# Judge status: Accepted
h,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
if h - sum(a) <= 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A,V = [int(v) for v in input().split()]
B,W = [int(v) for v in input().split()]
T = int(input())

A += int(1e9)
B += int(1e9)

if V * T + A >= W * T + B:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N = int(input())
S = input()
li = [0]
x = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    li.append(x)
print(max(li))
# Judge status: Accepted
a, b, c = list(map(int, input().split()))
if b - a == c - b:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a,b = map(int,input().split())
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

print(len(set(prime_factorize(a))&set(prime_factorize(b)))+1)
# Judge status: Wrong Answer
from fractions import gcd

def lcm(x, y):
    return x * y // gcd(x, y)

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

lcmall = A[0]

for a in A:
    lcmall = lcm(a, lcmall)
    if lcmall == 1:
        break

A.insert(0, 1)
A.insert(0, 1)
A.append(1)
A.append(1)

ans = 0
R = int(1e9) + 7

for i in range(2,n+2):
    ans += A[i-2]*A[i-1]*A[i]*A[i+1]*A[i+2] // lcmall**5
    if ans > R:
        ans = ans % R

print(ans)
# Judge status: Accepted
N = int(input())

S = input()

if N % 2 !=0:
  print("No")
elif S[0:int(N/2)] == S[int(N / 2):N]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc142/tasks/abc142_a

n = int(input())
print(((n + 1) // 2) / n)
# Judge status: Accepted
x, k, d = map(int, input().split())

if x < 0:
    x = -x

if x >= k * d:
    print(x - k * d)
else:
    if (x // d) % 2 == 1:
        if k % 2 == 1:
            print(x % d)
        else:
            print(d - x % d)
    else:
        if k % 2 == 1:
            print(d - x % d)
        else:
            print(x % d)
# Judge status: Accepted
lis = list(map(int, input().split()))
unique_list = []
for i in range(len(lis)):
    if lis[i] in lis[:i] + lis[i+1:] and lis[i] in unique_list:
        continue
    unique_list.append(lis[i])
print(len(unique_list))
# Judge status: Accepted
L = int(input())

a = float(L/3)

print(a**3)
# Judge status: Wrong Answer
N, K = map(int, input().split())

H = input().split()
H2 = [0] * N
for i in range(K):
    a, b = map(int, input().split())
    if H[a-1] > H[b-1]:
        H2[b-1] = 1
    elif H[a-1] < H[b-1]:
        H2[a-1] = 1
    elif H[a-1] == H[b-1]:
        H2[b-1] = 1
        H2[a-1] = 1

count = 0
for i in H2:
    if i == 1:
        count+=1
print(count)
# Judge status: Accepted
import sys
n,m=map(int,input().split())
number=[0]*n
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0 and n!=1:
        print(-1)
        sys.exit()
    if number[s-1]==0:
        number[s-1]=c
    elif number[s-1]==c:
        continue
    else:
        print(-1)
        sys.exit()
if number[0]==0 and n!=1:
    number[0]=1
answer=''
for i in range(len(number)):
    answer+=str(number[i])
print(int(answer))
# Judge status: Wrong Answer
n, k = list(map(int, input().split(' ')))
result = 0
if k < n:
    result = n % k
elif n < k:
    result = min(n, k-n)
print(result)
# Judge status: Wrong Answer
h, n = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]

max_a = max(a)[0]

dp = [float('inf') for i in range(h + max_a + 1)]
dp[0] = 0
for i in range(1, h+max_a + 1):
    dp[i] = min(dp[i-x]+y for x,y in a)

print(dp[h])
# Judge status: Accepted
c = str(input())
vowels = ['a','e','i','o','u']
if c in vowels:
    answer = 'vowel'
else:
    answer = 'consonant'
print(answer)
# Judge status: Accepted
n,m=map(int,input().split())
if ((n<0 and m>0) or n==0 or m==0):
    print("Zero")
if (n>0 and m>0):
    print('Positive')
if (m<0):
    if ((m-n)%2==0):
        print("Negative")
    else:
        print("Positive")
# Judge status: Accepted
n = int(input())
if n % 2 == 1:
    print(0)
else:
    cnt = 0
    r = 2
    while r < n:
        r *= 5  
        cnt += n // r
    print(cnt)
# Judge status: Accepted
from functools import reduce


def main():
    N = int(input())
    v = sorted(list(map(int, input().split())))
    print(reduce(lambda x, y: (x + y) * 0.5, v))


if __name__ == '__main__':
    main()
# Judge status: Accepted
# -*- coding: utf-8 -*-

N = int(input().strip())
A_list = list(map(int, input().rstrip().split()))
#-----

temp_A=[]
for i in range(len(A_list)):
    temp_A.append( A_list[i] - (i+1) )

temp_A.sort()
median = (temp_A[(N-1)//2] + temp_A[N//2]) // 2

b = median
sum=0
for i,a in enumerate(A_list):
    sum += abs( a - (b+(i+1)) )

print(sum)
# Judge status: Wrong Answer
n = int(input())
A = [0]*n
B = [0]*n
for i in range(n):
  A[i],B[i] = map(int,input().split())

ans = 0
for i in range(n):
  j = -1-i  
  if B[j] == 1:
    if A[j] != 0:
      continue
  ans += B[j] - (A[j]+ans)%B[j]  
  
print(ans)
# Judge status: Accepted
import numpy as np
s=np.array(list(map(int,input())))
a=[1 if i%2==0 else 0 for i in range(len(s))]
b=[0 if i%2==0 else 1 for i in range(len(s))]

a=np.array(a)
b=np.array(b)

c=s-a
d=s-b

print(min(np.count_nonzero(c!=0),np.count_nonzero(d!=0)))
# Judge status: Wrong Answer
N = int(input())
N_List = sorted(list(map(int,input().split())))
ct = 0
for i in range(1,N-1):
    if (N_List[i] > N_List[i-1]) & (N_List[i] < N_List[i+1]):
        ct += 1

print(ct)
# Judge status: Accepted
s = input()
x = list(map(int, list(s)))
x = x[::-1]
dic = [0 for _ in range(2020)]
ten = 1
y = 0
for i in range(len(s)):
    y = (y+ten*x[i])%2019
    dic[y] += 1
    ten = (ten*10)%2019
result = 0
for i in range(2019):
    result += max([dic[i]*(dic[i]-1)//2, 0])
result += dic[0]
print(result)
# Judge status: Accepted
s = input()
dirset = set()
for i in s:
  dirset.add(i)
if "N" in dirset and "S" in dirset:
  if ("E" in dirset and "W" in dirset) or (not "E" in dirset and not "W" in dirset):
    print("Yes")
  else:
    print("No")
elif "E" in dirset and "W" in dirset:
  if not "N" in dirset and not "S" in dirset:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Accepted
#!/usr/bin/env python3

n = int(input())
s = [int(input()) for _ in range(n)]
s = sorted(s)

ans = sum(s)
if ans%10 != 0:
    print(ans)
    exit(0)
    
for i in s:
    if i%10 != 0:
        ans -= i
        print(ans)
        exit(0)

print(0)
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
L = [[int(x) for x in input().split()] for _ in range(M)]

reg = min(a) + min(b)
for x, y, c in L:
    tmp = a[x-1] + b[y-1] - c
    reg = min(reg, tmp)
print(reg)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
for i in range(N-1):
    A[i] -= 1
ans = [0 for i in range(N)]
for a in A:
    ans[a] += 1
for i in range(N):
    print(ans[i])
# Judge status: Accepted
x=int(input())
import math
x5=math.ceil(x**0.2)
#print(x5)
import numpy as np 
while(True):
    for ii in np.arange(x5,-1,-1):
        for jj in range(x5+1):
            #print("a,b",ii,jj)
            if ii**5-jj**5==x:
                print(ii,jj)
                exit()
            if ii**5+jj**5==x:
                print(ii,-jj)
                exit()
    x5*=2
# Judge status: Accepted
N, M, X, Y = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
y.append(Y)

if max(x) >= min(y):
  print("War")
else:
  print("No War")
# Judge status: Accepted
def main():
    

    H, W = map(int, input().split())
    if H == 1 or W == 1:
        print(1)
    else:
        print(-(-H*W // 2))


if __name__ == "__main__":
    main()
# Judge status: Accepted
A, B, K = map(int, input().split())
 
if K <= A:
  print(A-K, B)
elif A+B >= K > A:
  print(0, B-(K-A))
else:
  print(0, 0)
# Judge status: Accepted
s=list(input())
if len(s)==len(set(s)):
    print("yes")
else:
    print("no")
# Judge status: Accepted
x = input().split()

h1 = int(x[0])
m1 = int(x[1])
h2 = int(x[2])
m2 = int(x[3])
k = int(x[4])

print((h2-h1)*60+m2-m1-k)
# Judge status: Wrong Answer
c=[list(map(int,input().split())) for _ in range(3)]

ans = "Yes"

for i in range(2):
    if c[i+1][1]-c[i+1][0] != c[0][1]-c[0][0]:
        ans = "No"
for j in range(2):
    if c[1][i+1]-c[0][i+1] != c[1][0]-c[0][0]:
        ans = "No"

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

stack_s = []
out = []

for x in X:
    if x == "S":
        stack_s.append("S")
    else:
        if len(stack_s) > 0:
            stack_s.pop()
        else:
            out.append("T")

while len(stack_s) > 0:
    out.append(stack_s.pop())

print(len(out))
# Judge status: Accepted
n = int(input())
mod = 10**9+7
ans = pow(10, n, mod)
ans -= pow(9, n, mod)*2
ans += pow(8, n, mod)
print(ans % mod)
# Judge status: Wrong Answer
n = int(input())
print(n)
l = list(map(int,input().split()))

res = 0
for t0 in range(0,len(l)-2):
    for t1 in range(t0+1,len(l)-1):
        for t2 in range(t1+1,len(l)):

             if (l[t0] + l[t1] > l[t2] and l[t0] + l[t2] > l[t1] and l[t1] + l[t2] > l[t0] and l[t0]!=l[t1] and l[t1]!=l[t2] and l[t0]!=l[t2]):
                 res += 1        

print(res)
# Judge status: Accepted
import itertools
n,k=map(int,input().split())
l=list(map(int,input().split()))
if k>42:
    l=[n]*n
    print(*l)
else:
    for _ in range(k):
        countl=[0]*(n+1)
        for i in range(n):
            countl[max(1,i+1-l[i])]+=1
            if i+2+l[i]<=n:
                countl[i+2+l[i]]-=1
            
        l=list(itertools.accumulate(countl))
        l.remove(l[0])
    print(*l)
# Judge status: Wrong Answer
A, B = map(float, input().split())
s = (A*(B*100))/100
print(s)
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
print("No" if s == "AAA" or s == "BBB" else "Yes")
# Judge status: Accepted
a, b = list(map(int,input().split()))
if a <= 8 and b <=8:
    print('Yay!')
else:
    print(':(')
# Judge status: Accepted
x = int(open(0).read().split()[0])

import heapq

s = {0} 
hq = [0]

prices = list(range(100, 106))

tmp = 0

while tmp<x:
    tmp = heapq.heappop(hq)
    for price in prices:
        new = tmp+price
        if new not in s:
            s.add(new)
            heapq.heappush(hq, new)

print(int(tmp == x))
# Judge status: Wrong Answer
n = int(input())
max_x = max_y = 0
min_x = min_y = 5 * 10**9
for i in range(n):
    X, Y = map(int, input().split())
    x = X + Y
    y = X - Y
    max_x = max(max_x, x)
    max_y = max(max_y, y)
    min_x = min(min_x, x)
    min_y = min(min_y, y)
print(max(max_x - min_x, max_y - min_y))
# Judge status: Accepted
n,a,b=map(int,input().split())
if (b-a)%2 == 0:
    print((b-a)//2)
else:
    if n-b >= a-1:
        ans = a-1
        ans += (b-a-1)//2
        print(ans+1)
    else:
        ans = n-b
        ans += (b-a-1)//2
        print(ans+1)
# Judge status: Wrong Answer
n=int(input())
s=input()
c=s.count
r,g,b=c('R'),c('G'),c('B')
t=0
for k in ('RGB','RBG','GRB','GBR','BRG','BGR'):
  for w in range(1,n//2):
    for i in range(n):
      if i+w*2<n:
        t+=s[i:i+w*2+1:w]==k
print(r*g*b-t)
# Judge status: Wrong Answer
S=input()
F=int(S[:2])
L=int(S[2:])

if 0<F<=12:
    if 0<L<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0<L<=12:
    print('YYMM')
else:
    print('NA')
# Judge status: Wrong Answer
s = list(map(int, input()))
k = int(input())
res = int()
n = int()
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        n = i + 1
        break
if k > n:
    print(res)
else:
    print(1)
# Judge status: Accepted
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()))
r += sorted(p)[-x:]
r += sorted(q)[-y:]
ans = sum(sorted(r)[-(x+y):])
print(ans)
# Judge status: Accepted
from collections import Counter
from operator import itemgetter
import numpy as np

N, K = map(int, input().split())
A = list(map(int, input().split()))
c = np.array(sorted(Counter(A).items(), key=itemgetter(1), reverse=True))
a_to_replace = c[K:]
print(sum(a_to_replace[:,1]))
# Judge status: Wrong Answer
A = list(map(int, input().split()))
 
K = A[0]
X = A[1]
 
money = K*500
 
if money <= X:
	print ("Yes")
else:
	print("No")
# Judge status: Accepted
s= input()
print(s[0]+s[1]+s[2])
# Judge status: Accepted
a, b = map(str, input().split() )

A = a * int(b)
B = b * int(a)

#print(A, B)

C = [A, B]
C.sort()

print(C[0])
# Judge status: Wrong Answer
#スペース区切りの整数の入力
N,D = map(int, input().split())

D_ = D*2 + 1

if(N%D_ == 0):
  print("a",int(N/D_))
else:
  print(int(N/D_+1))
# Judge status: Accepted
N_shima, M_fune = map(int, input().split())

shima_1 = []
shima_N = []

for i in range(M_fune):
    a, b = map(int, input().split())

    if (a == 1):
        shima_1.append(b)
    elif (a == N_shima):
        shima_N.append(b)
    if (b == 1):
        shima_1.append(a)
    elif (b == N_shima):
        shima_N.append(a)
    
judge = set(shima_1) & set(shima_N)

if (len(judge) >= 1):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
n=int(input())
s=input()
w=s.count(".")
ans=w
b=0
for i in range(n):
    if s[i]=="#":
        b+=1
    else:
        w-=1
    ans=min(ans,b+w)
print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    from collections import Counter
    s = Counter(input())
    for i in range(1,n):
        s = s & Counter(input())
    print(''.join(sorted(s.elements())))

if __name__ == '__main__':
    main()
# Judge status: Accepted
K,A,B = map(int,input().split())

if B-A < 2:
    print(1+K)
    exit()

cnt = A-1
K -= cnt
print(A+((B-A)*(K//2)+K%2))
# Judge status: Accepted
a,b=map(int,input().split())
print(abs(-(a+b)//2))
# Judge status: Accepted
N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

B.sort(reverse=True)
Amax = max(A)
cnt = 0
for b in B:
    if Amax <= b:
        H -= b
        cnt += 1
        if H <= 0:
            print(cnt)
            exit()

print((H-1)//Amax+1 + cnt)
# Judge status: Accepted
N = int(input())
S = input()

num = 0
max_num = num

for l in S:
    if l == 'I':
        num += 1
    else :
        num -= 1
    if num > max_num:
        max_num = num
        
print(max_num)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = readline().decode('utf8')

ans = 0
for i in S:
    cnt = 0
    if i == 'I':
        cnt += 1
    else:
        cnt -= 1

    max(ans, cnt)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
syoji = 1000
kabu = 0
kai = 0
for i in range(N):
  sw = 0
  if i < N-1:
    if kabu == 0 and A[i] < A[i+1]:
      sw = 1
  if kabu > 0 and kai < A[i]:
    syoji = syoji + kabu*A[i]
    kabu = 0 
  if sw == 1:#zengai
    for num in range (100):
      if syoji < num*A[i]:
        kabu = num-1
        syoji = syoji - (num-1)*A[i]
        kai = A[i]
        break
        
print(syoji)
# Judge status: Accepted
x, a, b = map(int, input().split())
if a >= b:
  print("delicious")
elif a < b <= a+x:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
a,b,c = sorted(map(int,input().split()))

if a+b ==c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
c = b.copy()
c.sort()
wa = 0
for i in c:
    wa += a[b.index(i)]
    if wa > b[b.index(i)]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
s=input()
res=s[0::2].count('0')+s[1::2].count('1')
print(min(res,len(s)-res))
# Judge status: Accepted
n, m = [int(elem) for elem in input().split()]
print(n * (n-1) // 2 + m * (m-1) // 2)
# Judge status: Accepted
s = input().split('/')
print('2018/'+s[1]+'/'+s[2])