peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from itertools import combinations

N, M, X = map(int, input().split())
books = []
for _ in range(N):
    books.append(list(map(int, input().split())))

prices = []
for i in range(1, N+1):
    for to_buy in combinations(books, i):
        _b = list(zip(*to_buy))
        _price = sum(_b[0])
        _points = _b[1:]
        if all([True if sum(x) >= X else False
                for x in _points]):
            prices.append(_price)

print(min(prices) if len(prices) else '-1')
# Judge status: Accepted
N = int(input())
S = []
for _ in range(N):
    S.append(int(input()))
S = sorted(S)

ans = sum(S)
if ans % 10 != 0:
    print(ans)
else:
    for s in S:
        if s % 10 != 0:
            print(ans - s)
            break
    else:
        print(0)
# Judge status: Wrong Answer
N, M = map(int, input().split())
PS = [input().split() for _ in range(M)]

AC = [False] * (N+1)
ans = 0
pena = 0

for p, s in PS:
    p = int(p)
    if AC[p]:
        continue
    elif s == "WA":
        pena += 1
    elif s == "AC":
        ans += 1
        AC[p] = True


print(ans, pena, sep=' ')
# Judge status: Accepted
n = int(input().replace(' ', ''))
print('Yes' if n==int(n**0.5)**2 else 'No')
# Judge status: Wrong Answer
def main():
  N = int(input())
  A = list(map(int, input().split()))
  A = sorted(A, reverse = True)
  flag = True
  num = 0
  ans = 1
  for i in range(N-1):
    if A[i] == A[i+1] and flag:
      ans *= A[i]
      num += 1
      if num == 2:
        break
      flag = False
    elif not flag:
      flag = True
  print(ans)
main()
# Judge status: Wrong Answer
x = int(input())
l = [int(x) for x in input().split()]
counter = 0
for p in range(x):
  if l[p] > x:
    break
  for q in range(p):
    if p - q  == l[p] + l[q]:
      counter += 1
print(counter)
# Judge status: Accepted
def main():
    n = int(input())

    if n == 0:
        print(0)
        exit()

    ans = ''
    while n != 0:
        if n % (-2) == 0:
            ans = '0' + ans
        else:
            n -= 1
            ans = '1' + ans

        n /= (-2)

    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
# 6>5>6>5>6>5...
import math
y=int(input())
#print((55*x+9)//10=y)
print(((y*10-9)+54)//55)
# Judge status: Accepted
A,B,C = map(int,input().split())

if C-(A-B) > 0:
  print(C-(A-B))
else:
  print("0")
# Judge status: Accepted
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
S = input().rstrip()

ans,x = 0,0
for s in S:
    if s == "I":
        x += 1
    else:
        x -= 1
    ans = max(ans,x)

print(ans)
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

d = abs(a-b)
s = v - w

if s <= 0:
  print('NO')
  exit(0)

if (t * s) >= d:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n,x = map(int,input().split())
L = list(map(int,input().split()))
ans = 1
l = 0

for i in range(n):
    l += L[i]
    if l <= x:
        ans += 1
        
print(ans)
# Judge status: Wrong Answer
S = list(input())

if S[0] == S[1] and S[2] == S[3]:
  print("Yes")
elif S[0] == S[2] and S[1] == S[3]:
  print("Yes")
elif S[0] == S[3] and S[1] == S[2]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
S = input()
weather = ['Sunny', 'Cloudy', 'Rainy']
next = weather.index(S) + 1
if S == 'Rainy':
    print(weather[0])
else:
    print(weather[next])
# Judge status: Accepted
import collections
N,M = map(int, input().split())

A = [list(map(int, input().split())) for i in range(M)]

c = collections.Counter(sum(A,[]))

for i in range(1, N+1):
  print(c[i])
# Judge status: Wrong Answer
n, m, x, y = map(int, input().split())
xx = tuple(map(int, input().split()))
yy = tuple(map(int, input().split()))

if x > y:
    print('War')
    exit(0)

if min(yy) - max(xx) > 1:
    print("No War")
else:
    print("War")
# Judge status: Accepted
from functools import reduce
from fractions import gcd

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

n,m = map(int, input().split())
a = list(map(int, input().split()))
b = [n//2 for n in a]

l = reduce(lcm,b)

for i in range(n):
    if l//b[i]%2 == 0:
        print(0)
        break
else:
    print(m//l//2+m//l%2)
# Judge status: Accepted
print(1*(eval(input().replace(' ','%'))>0))
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))

x = 0
y = 0
selection = sorted(list(set(A)))[::-1]
c = collections.Counter(A)
for i in selection:
    if c[i] >= 4:
        if x == 0:
            x = i
        if y == 0:
            y = i
    elif c[i] >= 2:
        if x == 0:
            x = i
        elif y == 0:
            y = i
    if x != 0 and y != 0:
        print(x * y)
        exit()

print(x * y)
# Judge status: Wrong Answer
s = list(input())
t = list(input())
ls = len(s)
lt = len(t)
ans = ["UNRESTORABLE"]

if "?" not in set(s):
    print("".join(s))

for i in range(ls-lt+1):
    f = True
    for j in range(lt):
        f &= (s[i + j] == "?" or s[i + j] == t[j])

    if f:
        ans = s.copy()
        for j in range(lt):
            ans[i+j] = t[j]


print("".join(ans).replace("?", "a"))
# Judge status: Wrong Answer
S = input()

if S =="SSS":
  print(0)
elif S[1] == "S":
  print(1)
elif S == "RRR":
  print(3)
else:
  print(2)
# Judge status: Accepted
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
A.sort(reverse=True)
B = 0
ans = 0
for a in A:
    if B<K:
        B+=1
    else:
        ans += a

print(ans)
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))
cnt = 0
for i in range(N):
    if p[i]!=i+1: cnt += 1
if cnt==2 or cnt==0:print("YES")
else: print("NO")
# Judge status: Wrong Answer
K, S = map(int, input().split())
cnt = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y and 0 - x - y <= K:
            cnt += 1
print(cnt)
# Judge status: Accepted
S = input()
T = input()

ans = 0
for i in range(len(S)):
    if S[i] != T[i]:
        ans = ans + 1

print(ans)
# Judge status: Accepted
n = int(input())
lst = [0 for _ in range(n)]

for i in range(1, 101):
    for j in range(1, 101):
        for k in range(1, 101):
            num = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + i * k
            try:
                lst[num - 1] += 1
            except IndexError:
                pass
for num in lst:
    print(num)
# Judge status: Accepted
n, k = map(int, input().split())
print(-(-~-n // ~-k))
# Judge status: Accepted
from bisect import bisect_right
n = int(input())
a_list = []
for i in range(n):
    a = int(input())
    a_list.append(a)
a_list.reverse()
l_list = [a_list[0]]
for i in range(1, n):
    a = a_list[i]
    if l_list[-1] <= a:
        l_list.append(a)
    else:
        index = bisect_right(l_list, a)
        l_list[index] = a
print(len(l_list))
# Judge status: Wrong Answer
d = int(input())
ans = 'Chrimstmas'
e = 'Eve'
if d == 25:
    print(ans)
elif d == 24:
    print(ans, e)
elif d == 23:
    print(ans, e, e)
else:
    print(ans, e, e, e)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
if a == 1 and b == 2:
    print(3)
elif a == 2 and b ==3:
    print(1)
else:
    print(2)
# Judge status: Wrong Answer
h, n= map(int, input().split())
a = list(map(int, input().strip().split()))
total = sum(a) 
print(total)
if(h>total):
    print('No')
else:
    print('Yes')
# Judge status: Accepted
d,n=map(int,input().split())
ans=n*100**d
if n!=100:
    print(ans)
else:
    print(ans+1*100**d)
# Judge status: Wrong Answer
n,a,b = map(int, input().split())

k = n
h = 1
sum = 0
while n >= h :
  if h !=a and h != b:
  	sum += k
  k = k*(n-h)/(1+h)
  h += 1

print(sum%(10**9+7))
# Judge status: Wrong Answer
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
if (B-A)%2 == 0:
  Count = (B-A)/2
  print(int(Count))
else:
  if (N-A)<(B-1):
    print(int(N-A))
  else:
    print(int(B-1))
# Judge status: Accepted
N,M = map(int,input().split())

A = list(map(int,input().split()))
A.sort(reverse=True)
BC = []
for _ in range(M):
    B, C = (int(x) for x in input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: -x[1])

index = 0

ans = 0

while index < M and len(A) and A[-1] < BC[index][1]:
    b, c = BC[index]
    count = 0
    while len(A) and A[-1] < c and count < b:
        A.pop()
        ans += c
        count += 1
    index += 1
print(sum(A)+ans)
# Judge status: Wrong Answer
n=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(n):
    for j in range(8):
        if (j*400)<=A[i]<((j+1)*400):
            B.append(j)
    if 3200<=A[i]:
        C.append(i+100)
print(len(set(B)),min(len(set(B))+len(C),8))
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if abs(a-b)+w*t <= v*t:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a = input()
if a.islower:
    print('a')
else:
    print('A')
# Judge status: Accepted
N = int(input())

if N % 2 == 0:
    count = 10
    amount_5 = 0
    while count <= N:
        amount_5 += N // count
        count = count * 5
else:
    amount_5 = 0

print(amount_5)
# Judge status: Accepted
n, m = list(map(int, input().split()))
if n*n == m*n:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

t = [0 for i in range(N)]
diff = [0 for i in range(N)]

for i in range(N):
  t[i] = T - 0.006*H[i]
  diff[i] = abs(t[i] - A)

print(diff.index(min(diff))+1)
# Judge status: Accepted
n = int(input())
a1 = int(input())
a2 = int(input())
if a1 >= a2:
    maxa1 = a1
    maxa2 = a2
    res = 0
else:
    maxa1 = a2
    maxa2 = a1
    res = 1

for i in range(2, n):
    a_ = int(input())
    if maxa1 <= a_:
        maxa2 = maxa1
        maxa1 = a_
        res = i
    elif maxa2 <= a_:
        maxa2 = a_

for i in range(n):
    if i == res:
        print(maxa2)
    else:
        print(maxa1)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a == b:
  if b == c:
    print(1)
  else:
    print(2)
elif b == c:
  print(2)
else:
  print(3)
# Judge status: Accepted
n = int(input())

if(n==0):
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
s =  list(input())
ans = []
for mozi in s:
    if(mozi == "A" or mozi == "G" or mozi == "C" or mozi == "T"):
        ans.append(mozi)
    else:
        break
print("".join(ans))
# Judge status: Wrong Answer
#176-B

N = input()
while len(N) > 1:
  sum = 0
  for i in range(1,len(N)+1):
    sum += int(N[-i])
  N = str(sum)

if N == 9:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
from sys import stdin

s = stdin.readline().rstrip()
N = len(s)

if N == 1:
    print(1)
    exit()
elif N == 2:
    if s[0] == s[1]:
        print(1)
        exit()
    else:
        print(2)
        exit()

dp = [0]*N
dp[0] = 1
dp[1] = 1
for i in range(2,N):
    if s[i] == s[i-1]:
        dp[i] = dp[i-3] + 2
    else:
        dp[i] = dp[i-1] + 1

print(dp[N-1])
# Judge status: Wrong Answer
a =[chr(ord('a') + i) for i in range(26)]
a.append("a")
c = input()
print(a[a.index(c)])
# Judge status: Accepted
N, M = list(map(int, input().split()))
result = 0
if N == 1 and M == 1:
    result = 1
elif N == 1:
    result = M - 2
elif M == 1:
    result = N - 2
else:
    result = (N - 2) * (M - 2)
print(result)
# Judge status: Accepted
n = int(input())


def prime_factorize(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


fac = prime_factorize(n)

from collections import Counter

ctr = Counter(fac)

ans = 0
for val in ctr.values():
    cnt = 1
    while val - cnt >= 0:
        ans += 1
        val -= cnt
        cnt += 1


print(ans)
# Judge status: Accepted
a,b,c = map(int, input().split())
if c >= a and c <= b:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a = input()[0]
if a in "24579":
    print("hon")
elif a in "0168":
    print("pon")
else:
    print("bon")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ki=a[0::2]
ki2=[]
for i in ki[::-1]:
    ki2.append(i)
guu=a[1::2]
guu2=[]
for i in guu[::-1]:
    guu2.append(i)

if n%2==0:
    kotae=guu2+ki
else:
    kotae=ki2+guu

print(kotae)
# Judge status: Wrong Answer
list = input().split()
N = int(list[0])
K = int(list[1])
i = K
s = 0

def sum(a,b):
    i=0
    i = (a + b)*(b - a + 1)/2
    return i

while i <= N + 1:
    #print(sum(N-i+1,N) + sum(0,i-1))
    s = s + sum(N-i+1,N) - sum(0,i-1) + 1
    i += 1
print(s % (10**9+7))
# Judge status: Accepted
n,m = map(int, input().split())

h = [int(x) for x in input().split(' ')]
o = ['Good'] * n

road = []
for i in range(m):
    a,b = map(int, input().split())
    
    if(h[a-1] > h[b-1]):
        o[b-1] = 'Bad'
    elif(h[b-1] > h[a-1]):
        o[a-1] = 'Bad'
    else:
        o[a-1] = o[b-1] = 'Bad'

print(o.count('Good'))
# Judge status: Wrong Answer
n = int(input())
arr = []
for i in range(n):
  arr.append(tuple(map(int, input().split())))
arr.sort(key = sum)
mx = 0
for i in arr[1:]:
  if mx <= abs(i[0] - arr[0][0]) + abs(i[1] - arr[0][1]):
    mx = abs(i[0] - arr[0][0]) + abs(i[1] - arr[0][1])
print(mx)
# Judge status: Accepted
H = int(input())
#N,K,M= map(int,input().split())
#A =list(map(int,input().split()))
#L = [list(map(str,input().split())) for i in range(N)]
h = H
count = 0
while h:
    h = h//2
    count += 1

print(2**count-1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = [0]*n
for i,j in enumerate(a,start=1):
  ans[j-1] = i
for i in range(n):
  print(ans[i],' ', end='')
# Judge status: Accepted
print 6 - int(raw_input()) - int(raw_input())
# Judge status: Accepted
S = input()
flag = True
cflag = False
for i, c in enumerate(S):
    if i == 0:
        if c == "A":
            continue
        else:
            flag = False
            break

    if c == "C" and 2 <= i < len(S)-1:
        if cflag:
            flag = False
        cflag = True

    elif not (97 <= ord(c) <= 122):
        flag = False


if flag and cflag:
    print("AC")
else:
    print("WA")
# Judge status: Accepted
a,b=map(int,input().split())
ans=0
for i in range(b-a):
    ans+=i
print(ans-a)
# Judge status: Accepted
n = int(input())
import numpy as np
d = np.array(range(1,n+1))
print(np.sum(d) - np.sum(d[d%3==0]) - np.sum(d[d%5==0]) + np.sum(d[d%15==0]))
# Judge status: Wrong Answer
n = int(input())
if n >= 25:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

cnt = 0
if A >= B:
    while A >= B:
        B *= 2
        cnt += 1

if B >= C:
    while B >= C:
        C *= 2
        cnt += 1

if cnt <= K:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
mod = 10**9 + 7
print((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod)
# Judge status: Accepted
a = list(map(int, input().split()))
x = a[0]
y = a[1]
z = a[2]

if y + z > x:
    print(z-x+y)
else:
    print(0)
# Judge status: Accepted
import math

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

x = int(input())
print(lcm(x, 360)//x)
# Judge status: Accepted
K = int(input())

N = 0
count = -1

for i in range(K):
    N = (N*10+7)%K
    if N == 0:
        count = i+1
        break
    
print(count)
# Judge status: Accepted
def main():
    n = int(input())

    cont = 0
    for _ in range(n):
        a, b = map(int, input().split())
        if a == b:
            cont += 1
            if cont >= 3:
                print('Yes')
                return
        else:
            cont = 0
    print('No')


if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
t = input()
for i in range(len(s)):
    s = s[-1] + s[0:-1]
    if s == t:
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
i = 0
while i < n:
    while i+1 < n and a[i] == a[i+1]:
        i += 1
    if i+1 < n and a[i] < a[i+1]:
        while i+1 < n and a[i] <= a[i+1]:
            i += 1
    elif i+1 < n and a[i] > a[i+1]:
        while i+1 < n and a[i] >= a[i+1]:
            i += 1
    ans += 1
    i += 1
print(ans)
# Judge status: Accepted
def main():
    n=int(input())
    A=list(map(int,input().split()))
    A.sort(reverse=True)
    if n%2==0:
        ans=sum(A[:(n+1)//2])*2-A[0]
    else:
        ans=sum(A[:(n+1)//2])*2-A[0]-A[n//2]
    print(ans)
    
if __name__=='__main__':
    main()
# Judge status: Accepted
from decimal import *
getcontext().prec=1000
a,b,c=map(int,input().split())
A=Decimal(a)**Decimal("0.5")
B=Decimal(b)**Decimal("0.5")
C=Decimal(c)**Decimal("0.5")
D= Decimal(10) ** (-100)
if A+B+D<C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import defaultdict
n = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(n):
    for r in range(1,n):
        if i + r < n and 0 <= i - r:
            if S[i + r] != S[i - r] and S[i] != S[i - r]and S[i] != S[i + r]:
                ans -=1

print(ans)
# Judge status: Accepted
import numpy as np,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,X = LI()
CA = np.array([LI() for _ in range(N)])
ans = float('INF')
for i in range(2**N):
    bit = np.array([[i>>j&1 for j in range(N)]]).T
    temp = (CA*bit).sum(axis=0)
    if (temp[1:]>=X).all():
        ans = min(ans,temp[0])
print(ans if ans!=float('INF') else -1)
# Judge status: Accepted
N = int(input())
S = input()
L = [0]*(N+1)
for i in range(N):
  if S[i]=="E":
    L[i+1] = L[i]+1
  else:
    L[i+1] = L[i]
print(min(i-L[i]+L[N]-L[i+1] for i in range(N)))
# Judge status: Accepted
n, x, t=map(int,input().split())

if n % x == 0:
    result = int(n / x * t)
    
else:
    result = int((n // x + 1) * t)

print(result)
# Judge status: Accepted
import fractions

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

g = fractions.gcd(A, B)
d = []
p = []

for i in range(1,int(pow(g, 0.5))+1):
    if g % i == 0:
        d.append(i)
        if i != g//i:
           d.append(g//i)

for i in d:
    s = 0
    for j in range(1,int(pow(i, 0.5))+1):
        if i % j == 0:
            s += 1

    if s == 1:
        p.append(i)

print(len(p))
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
a = Y[N // 2 - 1]
b = Y[N // 2]
for i in range(N):
  if X[i] <= a:
    print(b)
  else:
    print(a)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n > k:
  print(k*x+(n-k)*y)
else:
  print(n*x)
# Judge status: Accepted
from collections import Counter
n = int(input())
s = Counter(input())
mod = 10 ** 9 + 7

x = 1
for v in s.values():
  x *= (v+1)
ans = x - 1
print(ans%mod)
# Judge status: Accepted
from math import ceil


def main():
    length, section_range = map(int, input().split(" "))
    numbers = list(map(int, input().split(" ")))
    print(ceil((length - 1) / (section_range - 1)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<b<c and a<c-b:
  print("dangerous")
elif a>=b>=c:
  print("delicious")
else: 
  print("safe")
# Judge status: Accepted
N,M = map(int,input().split())
wa_list= [0]*(N+2)
ac_list=[-1]*(N+2)
for i in range(M):
  p,a = map(str,input().split())
  p = int(p)
  if a =='WA':
    wa_list[p]+=1
  if a =='AC' and ac_list[p] == -1:
    ac_list[p]+=(wa_list[p]+1)
count = 0;count2 = 0
for i in ac_list:
  if i>=0:
    count+=1
    count2+=i
print(count,count2)
# Judge status: Accepted
a,b=map(int,input().split())
print(abs(a*b-(a+b)*2+4))
# Judge status: Accepted
N = int(input())

ans = 0
for i in range(1,N+1):
    if len(str(i))%2 == 1:
        ans += 1
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
NPM = [[0] * 3 for _ in range(M)]
for i in range(M):
    p, m = map(int, input().split())
    NPM[i][0] = i
    NPM[i][1] = p
    NPM[i][2] = m

NPM.sort(key = lambda x:(x[2]))

##print(NPM)
city_num = [0] * N
ans_list = [""] * M
for i in range(M):
    city_num[NPM[i][1]-1] += 1

    ans_list[NPM[i][0]] = "{:0>6}{:0>6}".format(NPM[i][1], city_num[NPM[i][1]-1])

for i in range(M):
    print(ans_list[i])
# Judge status: Wrong Answer
def main():
    from collections import Counter
    n, *a = map(int, open(0).read().split())
    b = Counter(a)
    *c, = map(lambda x: tuple(x), b.items())
    c.sort(key=lambda x: x[0], reverse=True)

    ans = 1
    count = 0
    for (k, v) in c:
        if v >= 2:
            ans *= k
            count += 1
        if count == 2:
            break
    if count < 2:
        print(0)
    else:
        print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math

a,b,c,d = map(int,input().split())

num1 = math.ceil(c / b)
num2 = math.ceil(a / d)

if num1 <= num2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())

if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
    print('hon')
elif n == 3:
    print('bon')
else:
    print('pon')
# Judge status: Accepted
S=input()
s=set(S)
if len(s)==2:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math


def solve():
    A, B, N = map(float, input().split())

    ans = 0
    div_ab = A/B
    div_1b = 1/B
    init_1 = (max(1, int(N)-100000)*A)/B
    init_2 = max(1, int(N)-100000)/B
    start = max(1, int(N)-100000)

    for i in range(max(1, int(N)-100000), int(N) + 1):
        ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)

    print(int(ans))


if __name__ == '__main__':
    solve()
# Judge status: Accepted
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  Ss = [int(x) for x in input().rstrip('\n').split()]
  print(Ss.index(max(Ss))+1)
# Judge status: Accepted
n=int(input())
l=[input() for _ in range(n)]
b=l[0][-1]
for w in l[1:]:
    if l.count(w)>1 or not w[0]==b:
        print('No')
        exit()
    b=w[-1]
print('Yes')
# Judge status: Accepted
N = int(input())
A_ls = input().split(' ')
rst = set()
for i in A_ls:
    rst.add(i)
if len(rst) == N:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split())

if A >= K:
  print(K)
elif A + B >= K:
  print(A)
else:
  print(max(A + B - C, -1 * K))
# Judge status: Accepted
N, A, B = list(map(int, input().split()))
S = input()
passed_num = 0
passed_foreigners_num = 0
for i in S:
    if passed_num < A + B:
        if i == 'a':
            print('Yes')
            passed_num += 1 
        elif i == 'b' and passed_foreigners_num < B:
            print('Yes')
            passed_num += 1 
            passed_foreigners_num += 1
        else:
            print('No')
    else:
        print('No')
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    BC = [list(map(int, input().split())) for i in range(Q)]
    print(BC)

    for i in range(Q):
        B, C = BC[i][0], BC[i][1]
        for j in range(len(A)):
            if A[j] == B:
                A[j] = C
        print(sum(A))


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))
ans = (n-1)//(k-1) +  1*((n-1)%(k-1)!=0)
print(ans)
# Judge status: Accepted
from collections import Counter

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

Bs = [i-A for i, A in enumerate(As)]
cnt = Counter(Bs)

ans = 0
for L in range(N):
    AL = As[L]
    cnt[L-AL] -= 1
    ans += cnt[L+AL]

print(ans)
# Judge status: Accepted
a,b,x=map(int,input().split())
if a<=x and x<=a+b:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
k,a,b = map(int,input().split())
if a+1 >= b:
    print(1+k)
else:
    if k // (a+1) == 0:
        print(1+k)
    else:
        k -= a+1
        ans = b
        if k%2 == 0:
            print(ans+k//2*(b-a))
        else:
            print(ans+k//2*(b-a)+1)