Harryxun/stf_run huggingface dataset:
def main():

	numbers = input().split()
	a, b = map(int, numbers)

	d = a // b
	r = a % b
	f = a / b


	if d == 1:
		print(d)
	else:
		print('{0} {1} {2}'.format(d, r, f))
	


if __name__=="__main__":
	main()

### FIXED CODE ###

def main():

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

	a_to_b = list(range(a, b + 1))    #a to b
	result = [x for x in a_to_b if c % x == 0]
	#約数検索
	count = int(len(result))
	print(count)
	


if __name__=="__main__":
	main()
s=input()
n=len(s)
ans=0
for i in range(n):
  for j in range(i,n)
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)


### FIXED CODE ###

s = input()
n = len(s) # 文字列の長さを取得しておく

res = 0 # 条件になければ0
for i in range(n): # Sの部分文字列を全探索するループ：重複を許す（i==jの時は1文字の部分文字列になる）が入替を許さないループ
    for j in range(i, n):
        sub = s[i: j+1] # i文字目からからj文字目までの部分文字列

        flg = True
        for c in sub: # Python的for文
            if(c not in ['A', 'G', 'C', 'T']): flg = False # こちらも、in はこういう時便利です

        if(flg): res = max(res, len(sub)) # ACGT文字列の長さnumの最大値を保持する

print(res)
import numpy as np
n,m,l = map(int,input().split())
a = np.array([list(map(int,input().split())) for i in range(n)])
b = np.array([list(map(int,input().split())) for i in range(m)])
c = np.dot(a,b)
for i in range(n):
    for j in range(n):
        if j == n-1:print(c[i][j])
        else:print(c[i][j],end=" ")


### FIXED CODE ###

n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
b = [list(map(int,input().split())) for i in range(m)]
for i in range(n):
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += a[i][k]*b[k][j]
        if j==l-1:print(sum)
        else:print(sum,end=" ")
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X = int(input())
Y = int(input())
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()


X, Y = list(map(int, input().split()))
Turtle = (Y - 2*X ) / 2
Crane = X - Turtle
if Turtle >= 0 and Crane >= 0 and is_integer(Turtle) and is_integer(Crane):
    print("Yes")
else:
    print("No")
line = input()
 b=line.split()
if b[1]=='+':
      print(int(b[0])+int(b[2]))
else:
      print(int(b[0])-int(b[2]))


### FIXED CODE ###

# python
my_input = str(input())
print(str(eval(my_input)))
import sys
H,W = map(int,input().split())
C = list()
C = set(map(int, sys.stdin))
for i in C:
    print(C[i])
    print(C[i])


### FIXED CODE ###

import sys

H, W = sys.stdin.readline().split()
C = map(str, sys.stdin)
for i in C:
    print(i)
    print(i)
from collections import deque
N, M = map(int, input().split())

E = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    E[A].append(B)
    E[B].append(A)

visited = [False for _ in range(N)]
ans = deque()

def dfs(p, one):
    if visited[p]:
        return False
    visited[p] = True
    for i in E[p]:
        if dfs(i, one):
            break
    if one:
        ans.appendleft(p+1)
    else:
        ans.append(p+1)
    return True

dfs(0, True)
for i in E[0]:
    if dfs(i, False):
        break

print(len(ans))
for i in ans:
    print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100005)

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

E = [[] for _ in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    E[A].append(B)
    E[B].append(A)

visited = [False for _ in range(N)]
ans = []

def dfs(p, one):
    if visited[p]:
        return False
    visited[p] = True
    if not one:
        ans.append(p+1)
    for i in E[p]:
        if dfs(i, one):
            break
    if one:
        ans.append(p+1)
    return True

dfs(0, True)
for i in E[0]:
    if dfs(i, False):
        break
print(len(ans))
for i in ans:
    print(i)
import math
a,b,c = map(int,input(),split())
n = math.pow((c-(a-b)), 2)
m = a*b*4
if((a+b) >= c):
	print("no")
else:
	if(n < m):
		print("yes")
	else:
		print("no")

### FIXED CODE ###

import math
a,b,c = map(int,input().split())
l = 4*a*b
r = (c-a-b)**2
if (a+b >= c):
    print("No")
else:
    if(l < r):
        print("Yes")
    else:
        print("No")
a,b = map (int, input().split)
if a<b:
    print("a < b")
    else a>b:
        print("a > b")
        else a == b:
            print("a == b")


### FIXED CODE ###

a,b = map (int, input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
n = int(input()) 
#n=3
lst = [int(i) for i in input().split()]
#lst = [2, 10, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [1000000000, 1000000000, 1000000000]
hps = set(lst)
while(1):
    hps = sorted(hps)
    print(hps)
    if(hps[0]==0): break
    if(hps[0]==hps[n-1]): break
    hps[1] = hps[1] - hps[0]
print(hps[1])

### FIXED CODE ###

def gcd(a,b):
    r = a%b
    #print(a,b,r)
    if(r==0): return b
    return gcd(b,r)
n = int(input()) 
#n=4
hps = [int(i) for i in input().split()]
#lst = [2, 2, 8, 40]
#lst = [5, 13, 8, 1000000000]
#lst = [0, 1, 0]
    ##2 4 5 -> 1
    ## minと全ての要素のgcd
hps = sorted(hps)
for i in range(1,n):
    hps[0] = gcd(hps[i], hps[0])
#print(hps)
for i in range(len(hps)):
    if(hps[i]==0): continue
    print(hps[i])
    break
k, x = map(int,input().spit())

L = []

for i in range(k*2-1):
    print(x-k+1+i,end=' ')


### FIXED CODE ###

k, x = map(int,input().split())

for i in range(k*2-1):
    print(x-k+1+i,end=' ')
import sys
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

n = int(input())
l = [int(x) for x in input().split()]

# cl = [0 for i in range(n)]
cl = []
ll = [x for x in set(l) if l.count(x) > 1]

# print(ll)

if not ll:
    for i in range(n):
        print(0)
    sys.exit()

sum = 0
for i in ll:
    m = l.count(i)
    nc = combinations_count(m, 2)
    sum += nc
    # print(nc)
    # cl[i-1] = nc - int(nc*(m-2)/m)
    cl.append(nc - int(nc * (m - 2) / m))

# print(sum)
# print(cl)
for i in l:
    # print(sum - cl[i-1])
    idx = ll.index(i)
    if idx:
        print(0)
    else:
        print(sum - cl[ll.index(i)])


### FIXED CODE ###

import collections

def combinations_count(n, r):
    return n * (n-1) // r


n = int(input())
l = [int(x) for x in input().split()]

l1 = []
l2 = []
c = collections.Counter(l)

total = sum([combinations_count(i, 2) for i in c.values()])

for a in l:
    print(total-combinations_count(c[a], 2)+combinations_count(c[a]-1, 2))
import numpy as np

n, k = map(int, input().split())
lst = list(map(int, input().split()))

#array = np.array(lst)
#po_array = array[array>=0]
#ne_array = abs(array[array<0])
#ne_array.sort()

po_array = sorted([x for x in lst if x >= 0])
ne_array = sorted([abs(x) for x in lst if x < 0])

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        if i == k-1:
            dist = short_array[i]
        else:
            dist = min(short_array[i]*2 + long_array[k-i-2], short_array[i] + long_array[k-i-2]*2)
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
lst = list(map(int, input().split()))

array = np.array(lst)
po_array = array[array>=0]
ne_array = abs(array[array<0])
ne_array.sort()

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        dist = 10**10
        if i == k-1:
            dist = short_array[i]
        elif k-i-1 <= len(long_array): 
            dist = min(short_array[i]*2 + long_array[k-i-2], short_array[i] + long_array[k-i-2]*2)
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)
W,H,x,y,r = input().split()

if r =< x  and x =< W-r and r =< y and y =< H-r:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

W, H, x, y, r = input().split()

if int(r) <= int(x) and int(x) <= int(W) - int(r):
    if int(r) <= int(y) and int(y) <= int(H) - int(r):
        print("Yes")
    else:
        print("No")

else:
    print("No")
s = input()
l = len(s)
r = 10000
for i in range(l-3):
	p = s[i] + s[i+1] + s[i+2]
    x = int(p)
    r = min(r, abs(x-753))
print(r)

### FIXED CODE ###

s = input()
l = len(s)
r = 10000
for i in range(l-2):
	p = s[i] + s[i+1] + s[i+2]
	x = int(p)
	r = min(r, abs(x-753))
print(r)
X,Y,Z = map(int,input().sp;split())
print(Z,X,Y)

### FIXED CODE ###

import sys
#readline = sys.stdin.readline()
A,B,C = map(int,input().split())
print(C,A,B)
n = int(input())
*l, = map(int,input().split())
l = l.sort()
ans=l[0]
for i in l:
  ans = ans/2 + i/2
print(ans)

### FIXED CODE ###

n = int(input())
*l, = map(int,input().split())
l.sort()
ans=l[0]
for i in l:
  ans = ans/2 + i/2
print(ans)
def main():
    s = input()
    c = 0
    if s[0] == s[1] == s[2] == "R":
            print(3)
        return
    if s[0] == s[1] == "R" or s[1] == s[2] == "R":
        print(2)
        return
    if s[0] == s[1] == s[2] == "S":
        print(0)
        return

    print(1)
    return

main()



### FIXED CODE ###

def main():
    s = input()
    c = 0
    if s[0] == s[1] == s[2] == "R":
        print(3)
        return
    if s[0] == s[1] == "R" or s[1] == s[2] == "R":
        print(2)
        return
    if s[0] == s[1] == s[2] == "S":
        print(0)
        return

    print(1)
    return

main()
n = int(input())
LST = [0] * n
for i in range(n):
    p = int(input())
    lst = [[0]*2 for _ in range(p)]
    for j in range(p):
        a, b = list(map(int, input().split()))
        lst[j][0] = a - 1
        lst[j][1] = b
    LST[i] = lst

def checker(bit):
    flag = True
    for i in range(n):
        if not ((bit >> 2-i) & 1):
            continue
        num = len(LST[i])
        for j in range(num):
            people = LST[i][j][0]
            TF = LST[i][j][1]
            if TF == 0 and ((bit >> 2-people) & 1) == 1:
                flag = False
            if TF == 1 and ((bit >> 2-people) & 1) != 1:
                flag = False
    return flag

max_num = 0
for k in range(n ** 2 - 1):
    cnt = 0
    if checker(k):
        for l in range(n):
            if((k >> l) & 1):
                cnt += 1
        if cnt > max_num:
            max_num = cnt

print(max_num)

### FIXED CODE ###

n = int(input())
words_list = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        words_list[i].append((x - 1, y))

ans = 0
for i in range(2 ** n):
    peoples = []
    flag = True
    for j in range(n):
        if (i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    for k in range(n):
        if peoples[k] == 1:
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = False
                    break
    if flag:
        ans = max(ans, sum(peoples))

print(ans)
from fractions import gcd

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

H, W, N = getlist()
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
L = []
for i in range(N):
	a, b = getlist()
	for j in range(3):
		for k in range(3):
			if H - 2 >= a - j and a - j >= 1 and W - 2 >= b - k and b - k >= 1:
				L.append([a - j, b - k])

L = sorted(L)
n = len(L)
v = L[0]
c = 0
for i in range(n):
	if v == L[i]:
		c += 1
	else:
		ans[c] += 1
		c = 1
	v = L[i]
ans[c] += 1

for i in range(1, 10):
	ans[0] -= ans[i]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

from collections import defaultdict

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

H, W, N = getlist()
D = defaultdict(int)
D[0] += (H - 2) * (W - 2)
L = []
for i in range(N):
	a, b = getlist()
	for j in range(3):
		for k in range(3):
			if H - 2 >= a - j and a - j >= 1 and W - 2 >= b - k and b - k >= 1:
				L.append((a - j, b - k))

L = sorted(L)
n = len(L)
if n != 0:
	v = L[0]
c = 0
for i in range(n):
	if v == L[i]:
		c += 1
	else:
		D[c] += 1
		c = 1
	v = L[i]

if n != 0:
	D[c] += 1
for i in range(1, 10):
	D[0] -= D[i]

for i in range(10):
	print(D[i])
n=input()
m=set(sorted(n))
a,b=0,0
for i in n:
    if len(m)!=2:
        print("No")
        break
    if i==m[0]:
        a+=1
    elif i==m[1]:
        b+=1
else:
    if a==2 and b==0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n=input()
m=set(n)
if len(m)==2 and n.count(n[0])==2:
    print("Yes")
else:
    print("No")
x = int(input())

res = [False for i in range(x + 1)]
res[0] = True
for i in range(100, 106):
    res[i] = True

for i in range(106, x + 1):
    res[i] = res[i-100] or res[i-101] or res[i-102] or res[i-103] or res[i-104] or res[i-105]

if res[x]:
    print(1)
else:
    print(0)


### FIXED CODE ###

x = int(input())

res = [False for i in range(x + 1)]
res[0] = True
for i in range(100, 106):
    if x < i:
        break
    res[i] = True

for i in range(106, x + 1):
    res[i] = res[i-100] or res[i-101] or res[i-102] or res[i-103] or res[i-104] or res[i-105]

if res[x]:
    print(1)
else:
    print(0)
import fractions

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

A -= 1

lcm = (C * D) // fractions.gcd(C, D)

excluded = A - (A // C + A // D - A // lcm)
num = B - (B // C + B // D - B // lcm)

print(num - excluded)

### FIXED CODE ###

S = input()

if S[0] != S[1] and S[1] != S[2] and S[2] != S[3]:
    print('Good')
else:
    print('Bad')
N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

top = [[] for _ in range(101*101)]

for i in range(101):
    for j in range(101):
        top[i*101+j] = [i, j]

#print(top)

H = 0

for i in range(len(top)):
    topx = top[i][0]
    topy = top[i][1]
    H = 0
    h_list = []
    for j in range(N):
        tmp = abs(topx - x[j]) + abs(topy - y[j]) + h[j]
        h_list.append(tmp)
    if h_list.count(h_list[0]) == N :
        ansx = topx
        ansy = topy
        ansH = h_list[0]
        break

print(topx, topy, ansH)


### FIXED CODE ###

N = int(input())
x = [0] * N
y = [0] * N
h = [0] * N
for i in range(N):
    x[i], y[i], h[i] = map(int, input().split())

top = [[] for _ in range(101*101)]

for i in range(101):
    for j in range(101):
        top[i*101+j] = [i, j]

#print(top)

H = 0
ansx = -100

for i in range(len(top)):
    topx = top[i][0]
    topy = top[i][1]
    H = 0
    h_list = []
    for j in range(N):
        tmp = abs(topx - x[j]) + abs(topy - y[j]) + h[j]
        h_list.append(tmp)
    if h_list.count(h_list[0]) == N :
        ansx = topx
        ansy = topy
        ansH = h_list[0]
        break

if ansx == -100:
    for i in range(len(top)):
        topx = top[i][0]
        topy = top[i][1]
        H = 0
        h_list = []
        for j in range(N):
            if h[j] != 0:
                tmp = abs(topx - x[j]) + abs(topy - y[j]) + h[j]
                h_list.append(tmp)
        if h_list.count(h_list[0]) == N - h.count(0) :
            ansx = topx
            ansy = topy
            ansH = h_list[0]
            break

print(ansx, ansy, ansH)
A, B, K = map(int, input().split())
num = [i for i in range(A, B+1)]
numset = []

if B < K:
    K = len(num)

for i in range(K):
    print(num[i])
    numset.append(num[i])

num.sort(reverse=True)
num = num[:K]
num.sort()

for i in range(K):
    if num[i] not in numset:
        print(num[i])


### FIXED CODE ###

A, B, K = map(int, input().split())
a = A
b = B

ans = []
for i in range(K):
    if A not in ans:
        ans.append(A)

    if B not in ans:
        ans.append(B)

    if A + 1 <= b:
        A += 1
    if B - 1 >= a:
        B -= 1

ans.sort()
for i in ans:
    print(i)
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cur = 1
    nums = []
    for i in range(N):
        if A[i] == 0:
            cur *= 1
            nums.append(0)
            continue
        #A[i] != 0
        cnt = 0
        for j, n in enumerate(nums):
            if n == A[i] - 1:
                if cnt == 0:
                    nums[j] += 1
                cnt += 1
        cur *= cnt
        cur %= 10**9+7
        # print(nums)
    m = [3, 6, 6]
    print(cur * m[len(nums)-1])
main()

### FIXED CODE ###

# def i():
#     yield "100000"
#     a = 0
#     b = 0
#     c = 0
#     l = []
#     for i in range(100000):
#         import random
#         r = random.randint(0, 2)
#         if r == 0:
#             l.append(str(a))
#             a += 1
#         elif r == 1:
#             l.append(str(b))
#             b += 1
#         else:
#             l.append(str(c))
#             c += 1
#     yield " ".join(l)
# input = i().__next__
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cur = 1
    nums = []
    for i in range(N):
        if A[i] == 0:
            cur *= 1
            nums.append(0)
            continue
        #A[i] != 0
        cnt = 0
        for j, n in enumerate(nums):
            if n == A[i] - 1:
                if cnt == 0:
                    if len(nums) <= j:
                        print(0)
                        return
                    nums[j] += 1
                cnt += 1
        cur *= cnt
        cur %= 10**9+7
        # print(nums)
    m = [0, 3, 6, 6]
    if len(nums) >= 4:
        print(0)
        return
    
    print((cur * m[len(nums)]) % (10**9+7))
main()
N = int(input())
D = input()
D =  D.split(' ')
D = [int(d) for d in D]
D_sort = np.sort(D)

k = int(N/2)
count = 0

low_d = D_sort[k-1]
hight_D = D_sort[k]
dis = hight_D - (low_d+1) + 1

print(dis)
    

### FIXED CODE ###

import numpy as np

N = int(input())
D = input()
D =  D.split(' ')
D = [int(d) for d in D]
D_sort = np.sort(D)

k = int(N/2)
count = 0

low_d = D_sort[k-1]
hight_D = D_sort[k]
dis = hight_D - (low_d+1) + 1

print(dis)
import math
a,b=int(input())
x=a*b/2
print(math.ceil(x))


### FIXED CODE ###

import math
a,b=map(int,input().split())
x=(a+b)/2
print(math.ceil(x))
n = int(input())
tree = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b, c = map(int, input().split())
    tree[a].append((b, c))
    tree[b].append((a, c))

depth = [0] * (n + 1)
def dfs(v, p, d):
    depth[v] = d
    for to, cost in tree[v]:
        if to != p:
            dfs(to, v, d + cost)

q, k = map(int, input().split())
dfs(k, -1, 0)
for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n = int(input())
tree = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b, c = map(int, input().split())
    tree[a].append((b, c))
    tree[b].append((a, c))

depth = [0] * (n + 1)
def dfs(v, p, d):
    depth[v] = d
    for to, cost in tree[v]:
        if to != p:
            dfs(to, v, d + cost)

q, k = map(int, input().split())
dfs(k, 0, 0)
xy = [tuple(map(int, input().split())) for i in range(q)]

for x, y in xy:
    print(depth[x] + depth[y])
def chmin(a, b):
    if a > b:
        a = b
N = int(input())
h = list(map(int,input().split()))
dp = [10**5] * (N+10)
for i in range(1, N):
    dp[i+1] = chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
    dp[i+2] = chmin(dp[i+2], dp[i] + abs(h[i+2] - h[i]))
print(dp[N-1])


### FIXED CODE ###

N = int(input())
h = list(map(int,input().split()))
dp = [0] * N
for i in range(1, N):
    if i == 1:
        dp[i] = abs(h[1] - h[0])
    else:
        dp[i] = min(abs(h[i] - h[i-1])+dp[i-1], abs(h[i] - h[i-2])+dp[i-2])
print(dp[N-1])
n,k  = map(int,input().split())
a = list(map(int,input().split()))
a.insert(0,0)
print(a)

town =1
visited = [0] * (n+1)

for i in range(1,k+1):
    town = a[town]
    if visited[town] !=0:
        rest =(k - visited[town]) % (i -visited[town])
        goal =visited.index(visited[town]+rest)
        break
    visited[town] = i 
    

print(goal)

### FIXED CODE ###

import sys
import numpy as np
from collections import defaultdict



#input = sys.stdin.readline

def main():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))
    A = [0] +A  #transporter
    visited = [0] * (N+1)
    town = 1
    cycle = 0
    for i in range(1,K+1):
        town = A[town]
        if visited[town] ==0:
            visited[town] = i
        else:
            cycle = i - visited[town]
            place = (K - visited[town]) % cycle + visited[town]
            for j in range(N+1):
                if visited[j] == place:
                    print(j)
                    exit()
    print(town)




if __name__ == "__main__":
    main()
import math
a, b, n = map(int, input().split())
p = min(b, n)
if p % b == 0:
    print(int(a(p-1))/b)
else:
    print(int((a(p))/b))

### FIXED CODE ###

A,B,N = map(int, input().split())
c = min(N,B)
if c % B == 0:
    print(int(A*(c-1)/B))
else :
    print(int(A*(c)/B))
# -*- coding: utf-8 -*-

# input
# ATCODER

i = input()

c = 0
c_list = []
for moji in i:
    if moji in ['A', 'C', 'G', 'T']:
        c += 1
    else:
        c_list.append(c)
        c = 0


print(max(c_list))

### FIXED CODE ###

# -*- coding: utf-8 -*-

i = input()

c = 0
c_list = []

if len(i) == 1:
    if i in ['A', 'C', 'G', 'T']:
        print(1)
        exit()
    else:
        print(0)
        exit()

for moji in i:
    if moji in ['A', 'C', 'G', 'T']:
        c += 1
        c_list.append(c)
    else:
        c_list.append(c)
        c = 0

print(max(c_list))
l = map( int , raw_input().split())

s = l[0] * l[1]
r = l[0] + l[0] + l[1] + l[1]

print s + ' ' + r

### FIXED CODE ###

l = map( int , raw_input().split())

s = l[0] * l[1]
r = ( l[0] + l[1] ) * 2

print s , r
n=int(input())
a=list(map(int,input().split()))
sl=[a[0]]
for i in range(1,n):
    sl.append(sl[-1]+a[i])
b=a[::-1]
sr=[b[0]]
for i in range(1,n):
    sr.append(sr[-1]+b[i])
from bisect import bisect_left,bisect_right
ans=[]
for i in range(1,n-3):
    #左側決める
    l=sl[i]
    kl=l//2
    lsl,lsr=bisect_left(a,kl,hi=i),bisect_right(a,kl,hi=i)-1
    if lsr<0:
        lsr+=1
    if abs(sl[lsl]-(l-sl[lsl]))<abs(sl[lsr]-(l-sl[lsr])):
        candl=[sl[lsl],l-sl[lsl]]
    else:
        candl=[sl[lsr],l-sl[lsr]]
    #右側決める
    r=sr[n-(i+1)-1]
    kr=r//2
    rsl,rsr=bisect_left(b,kr,hi=n-(i+1)-1),bisect_right(b,kr,hi=n-(i+1)-1)-1
    if rsr<0:
        rsr+=1
    if abs(sr[rsl]-(r-sr[rsl]))<abs(sr[rsr]-(r-sr[rsr])):
        candr=[sr[rsl],r-sr[rsl]]
    else:
        candr=[sr[rsr],r-sr[rsr]]
    ans.append(max(candl+candr)-min(candl+candr))
print(min(ans))




### FIXED CODE ###

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

def f(c,i):
    global n,a,s
    return abs(s[c]-(s[i]-s[c]))

def g(c,i):
    global n,a,s
    return abs((s[c]-s[i])-(s[n-1]-s[c]))

ans=[]
for i in range(1,n-2):
    ans_=[]
    #左側決める
    l,r=0,i
    while l+2<r:
        c1=(l*2+r)//3
        c2=(l+2*r)//3
        if f(c1,i)>f(c2,i):
            l=c1
        else:
            r=c2
    x=sorted([(f(j,i),j) for j in range(l,r+1)])[0][1]
    ans_.append(s[x])
    ans_.append(s[i]-s[x])

    #右側決める
    l,r=i+1,n-1
    while l+2<r:
        c1=(l*2+r)//3
        c2=(l+2*r)//3
        if g(c1,i)>g(c2,i):
            l=c1
        else:
            r=c2
    x=sorted([(g(j,i),j) for j in range(l,r+1)])[0][1]
    ans_.append(s[x]-s[i])
    ans_.append(s[n-1]-s[x])

    ans.append(max(ans_)-min(ans_))
print(min(ans))