peterverebics/CodeNet_Python_118 huggingface dataset:
import math
from collections import deque
a,b,c=[int(_) for _ in input().split()]
k=c-1
s=math.floor((k*a)/b)-a*math.floor(k/b)
t=math.floor((c*a)/b)-a*math.floor(c/b)
if b<c:
    l=b-1
    g=b
    v=math.floor((l*a)/b)-a*math.floor(l/b)
    m=math.floor((g*a)/b)-a*math.floor(g/b)
    print(s,t,m,v)
else:
    print(max(s,t))
def f(a,b,x):
	return (a*x)//b - a*(x//b)
	
a,b,n=map(int,input().split())
res=0

if n<=b:
	res=f(a,b,n)
	print(res)
else:
	res=f(a,b,b-1)
	if n%b==0:
		res=max(res,f(a,b,n-1))
		print(res)
	else:
		res=max(res,f(a,b,(n//b)-1))
		print(res)
from math import gcd

def cal(A,B,x):
    return int((A*x)/B) - A*int(x/B)

def main():
    A,B,N = map(int,input().split())
    if N <= B-1:
        ans = cal(A,B,N)
    else:
        a,b = A//gcd(A,B),B//gcd(A,B)
        d = N // b
        ans = cal(A,B,b*d-1)
    print(ans)

if __name__ == "__main__":
    main()
A,B,N = list(map(int,input().split()))

def f(n):
    d = int(A*n/B) - A*int(n/B)
    return d

print(f(N))
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    A, B, N = map(int, input().split())

    if N / B < 1:
        x = N
        res = math.floor(A * x / B)
        return print(res)

    x = (N // B) * B - 1
    res = math.floor(A * x / B) - A * math.floor(x / B)
    print(max(0, res))


if __name__ == '__main__':
    main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

if n >= b:
    x = b-1
else:
    x = b

print(a*x//b-a*(x//b))
A, B, N = map(int, input().split())

ans = 0
k = 0

while True:
    x = B / A * k
    if x > N: break
    ans = max(A * x // B - A * (x // B), ans)
    k += 1

print(int(ans))
import math

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

max_v = 0
for i in reversed(range(1, N + 1)):
    current_max_v = math.floor(A * i // B) - A * math.floor(i / B)
    max_v = max(max_v, current_max_v)
    # 循環したらとめる
    if N > 100 and i > 2/N:
        break
print(max_v)
A,B,N=map(int,input().split())

import math
M = 0
for x in range(max(N-1000000,0),N+1):
    Z = math.floor(A * x / B) - A * math.floor(x / B)
    if M < Z:
        M = Z
print(M)
def main():
    import sys
    import math
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    A, B, N = [int(x) for x in input().strip().split()]
    ans = 0
    for x in range(N, N-A-1, -1):
        ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)
    
    print(ans)


if __name__ == '__main__':
    main()
l = input().split()
a = float(l[0])
b = float(l[1])
n = int(l[2])
max = 0
calc = 0
calc1 = 0
calc2 = 0
calc3 = 0
for i in range(1, n+1):
  calc1 = a*i // b 
  calc2 = i // b
  calc3 = a * calc2
  calc = calc1 - calc3
  if max < calc:
    max = calc
print(int(calc))
import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 7:
    for i in range(0,10**6+3*10**5):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
    for i in range(N-10**3,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
else:
    for i in range(0,N+1):
        maxi = max(int((A*i)/B)-A*int(i/B),maxi)
print(max(maxi,0))
[A,B,N] = list(map(int,input().split()))

X = N
Y = min(B-1,N)

out1 = A*X//B - A*(X//B)
out2 = A*Y//B - A*(Y//B)
print(min(out1,out2))
A,B,N=map(int,input().split())

if N<B:
    print(int(((A*N)/B)-((A*N)/B)%1-A*(N/B-(N/B)%1)))
else:
    N=N%B
    print(int(((A*N)/B)-((A*N)/B)%1-A*(N/B-(N/B)%1)))
a, b, n = map(int,input().split())

def binary_search():
    low = 1
    high = n

    m = 0

    while low <= high:
        mid = (low + high) // 2

        l = int(a*low/b) - a * (int(low/b))
        h = int(a*high/b) - a * (int(high/b))

        if h > l:
            high = mid -1
            m = max(m, l, h)
        else:
            low = mid + 1
            m = max(m, l, h)

    return m


print(binary_search())
a, b, n = map(int, input().split())
ans = []
for x in range(n+1):
    f = (a*x)//b - a* (x//b)
    ans.append(f)

print(ans[-1])
import math

A, B, N = map(int, input().split())
res = math.floor(((A * 1) / B)) - A * math.floor((1 / B))

for i in range(2, N + 1, 2):
    a = math.floor(((A * i) / B)) - A * math.floor((i / B))
    if res < a: res = a
print(res)
a,b,n = map(int,input().split())
ma = -1

if(n<=b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))

print(ma)
import math
a, b, n = map(int, input().split())
if b > n:
  print(math.floor(a * n / b))
  quit()
else:
  print(a)
import math
a, b, n = map(int, input().split())
c = []
for x in range(n):
  cc = math.floor(a*3/b) - a * math.floor(x/b)
  c.append(cc)
print(max(c))
import math
a, b, n = map(int, input().split())

if (b != 0):
  if (n >=b):
    x=math.floor(n/b)*b-1
    print (math.floor(a*x/b)-a*math.floor(x/b))
  else:
    print (math.floor(a*n/b)-a*math.floor(n/b))
else:
  print (0)
a,b,n = map(int,input().split())
import math
def func(x):
    y = math.floor((a*x)/b)-a*math.floor(x/b)
    return y

if b > n:
    print(func(n))
else:
    c = (n//b) -1
    d = b-1
    print(func(b*c + d))
A, B, N = map(int, input().split())
a = A//B
k = A%B
n = N//B

from math import floor
def f(x):
  return floor(A*x/B) - A * floor(x/B)

print(max(a*(B-1)-k-1, f(N)) if n>0 else f(N))
a, b, n = map(int, input().split())
if n < b:
    ans = a*n//b
else:
    ans = a*n//b
    # for i in range(1, n//b):
    #     check = (a*(b*(i+1)-1))//b - a*i
    #     ans = max(ans, check)
    ans = max(ans, (a*(b*n)//b)-a*(n//b))
print(ans)
import math
a,b,c=[int(_) for _ in input().split()]
k=c-1
s=math.floor((k*a)/b)-a*math.floor(k/b)
t=math.floor((c*a)/b)-a*math.floor(c/b)
print(max(s,t))
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
import math
if n <b:
    x=n
    ans=math.floor(a*x/b)
else:
    ans=0
print(ans)
import math
def fun(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

A, B, N = map(int,input().split())
x = min(B, N)
print(int(fun(A, B, x)))
from sys import stdin
import sys
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
# N, M = [int(x) for x in stdin.readline().rstrip().split()]
# U = input().split()
ans = int((A*N)/B)-A*int(N/B)
if B-1<=N:
	ans2 = int((A*(B-1))/B)-A*int((B-1)/B)
else:
  	ans2=0
    
if ans>=ans2:
  print(ans)
else:
  print(ans2)
a,b,n = map(int,input().split())
if a>n:
    print((n*a)//b - a*(n//b))
else:
    print(((n-1)*a)//b - a*((n-1)//b))
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
for i in range(1, C+1, B//A+1):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)
import math
a, b, n = map(int, input().strip().split())
if b<n:
    x=n
elif n % b <= n%(b/a):
    x=n-n%b-1
elif n%(b/a)+(b/a)>n%b:
    x=n-n%b-1
else:
    x=n
print(math.floor(a*x/b)-a*math.floor(x/b))
import math
num = list(map(int, input().split()))
check = True
x = num[2]
while check:
    result = math.floor(num[0] * x / num[1]) - num[0] * math.floor(x/ num[1])
    if(result > num[2]):
        x -= 1
    else:
        check = False
print(result)
from math import floor
a,b,n = map(int,input().split())
ans = 0
t = int(n/max(a,b))+1
if min(a,b) > n:
    for i in range(n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(t+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)
import math
l = list(input().split(" "))
a = int(l[0])
b = int(l[1])
n = int(l[2])
def f(x):
  return math.floor(x)
c = f(a/b) - a*f(1/b)
for i in range(2,n):
  d = f(a*i/b) - a*f(i/b)
  if c >= d:
    c = c
  else:
    c = float(d)
print(str(c))
a, b, n = map(int, input().split(" "))

max_score = 0
y = b // a

for x in range(max(y - 100, 1) , min(y + 200, n+1)):
    score = a * x // b - a * ( x // b )
    if score > max_score:
        max_score = score
print(max_score)
A,B,N=map(int,input().split())
if (B<=N):
    print(A*N//B)
else:
    c=(A*N)//B-A*(N//B)
    d=(A*B)//B-A
    print(max(c,d))
import math
 
A, B, N = map(int, input().split())
 
max = 0
for i in range(N, -1, -1):
    tmp = math.floor(A*i/B) - A*math.floor(i/B)
    if max < tmp:
        max = tmp
    elif max > tmp:
        break
 
print(max)
import math
A, B, N = map(int, input().split())

result = 1
for i in range(1, N + 1):
    result_new = math.floor(A * i / B) - A * math.floor(i / B)
    if result_new > result:
        result = result_new

print(result)
A, B, N = map(int, input().split(" "))

ans = 0
count = 0
for x in range(N,0,-1):
    if count > 1000000:
        break
    xb = x / B
    if xb < 1 and ans != 0:
        count += 1        
#         print("continue")
        continue
    floor = int(A*xb) - A * int(xb)
    if ans < floor:
        count = 0
        ans = floor
    count += 1
print(ans)
a,b,n=map(int,input().split())
maximum=0
for x in range(n):
    num=int(a*x/b)-a*int(x/b)
    if num>maximum:
        maximum=num
print(maximum)
A, B, N = map(int, input().split())
print(min(B-1, N))
import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = max(math.floor(a * c / b) - a * math.floor(c / b), math.floor(a * n / b) - a * math.floor(n / b))

print(ans)
import math
def resolve():
    a,b,n=map(int,input().split())
    if b<=n:
        i=b
    else:
        i=n
    y=math.floor(a*(i)/b)-a*math.floor((i)/b)

    print(y)
resolve()
A,B,N=map(int,input().split())
print(max(B-1,N))
A, B, N = map(int,input().split())

if (N < B):
    print((A*N)//B - A*(N//B))
else:
    print((A*(N-1))//B - A*((N-1)//B))
A, B, N = map(int, input().split())

def f(x):
    return (A * x) // B - A * (x // B)

high = N
low = 0
while high - low > 0.00001:
    mid_left = high / 3 + low * 2 / 3
    mid_right = high * 2 / 3 + low / 3
    # print(mid_left, mid_right)
    if f(mid_left) >= f(mid_right):
        high = mid_right
    else:
        low = mid_left
print(int(f(high)))
from math import floor
A,B,N = map(int,input().split())
Nomin = list()

while all:
    Nomin.append(floor(A*N/B))
    N-=1
    if(N==0):
        break
print(Nomin[0])
a, b, n = map(int, input().split())

if b <= n:
    print(a-1)
else:
    x = n - 1
    print(int(a*x/b) - a * int(x/b))
a, b, n = map(int, input().split())
ans = 0
tmp = []
idx = 0
for i in range(n, 0, -1):
    k = int(a * i / b) - (a * int(i / b))
    ans = max(ans, k)
    if i == n:
        tmp.append(k)
    else:
        if tmp[idx] == k:
            idx += 1
        else:
            idx = 0
        if idx == len(tmp) - 1:
            break
        tmp.append(k)
print(ans)
a, b, n = map(int, input().split())

if n < b-1:
    x = n
    print(a * x // b - a * (x // b))
    exit()

for x in range(n, 1, -1):
    if x%b == b-1:
        print(a * x // b - a * (x // b))
        exit()
import math
a,b,n=map(int,input().split())
max=-2
if b<n:
    n=b
max=math.floor(a*n-1/b)
print(max)
a,b,n=map(int,input().split())
import math
ans1=math.floor(a*(b-1)/b)
ans2=math.floor(a*(n-1)/b)
print(max(ans1,ans2))
import math
abn = list(map(int, input().split()))
a = abn[0]
b = abn[1]
n = abn[2]
ans = -100000000
for x in range(n + 1):
  val: int = math.floor(a * x / b) - a * math.floor(x / b)
  if val > ans:
    ans = val
print(val)
A,B,N = map(int,input().split())
ans = []
if N < 15:
    for x in range(N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
else:
    for x in range(N-100000,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))
a,b,n=map(int,input().split())
if n>=b-1:
    ans=a- int( a - a*(((b-1)/b)-int((b-1)/b)) )-1
else:
    ans = a- int( a - a*((n/b)-int(n/b)) )-1
print(ans)
a,b,n=map(int,input().split())
import math
if b==1:
  print(0)
else:
  print(math.floor(a*(b-1)/b))
import math
A,B,N = map(int,input().split())
point = 0
ans = 0
#for x in range(0,N+1):
x=N
#print(math.floor(A*x/B)-A*math.floor(x/B))
    #print(point)
    #print("p")
#    if point<math.floor(A*x/B)-A*math.floor(x/B):
point = math.floor(A*x/B)-A*math.floor(x/B)
print(point)
A, B, N = map(int,input().split())
max = 0
i=0
while(1):
 cal = int((A*N)/B) - A*int(N/B)
 if(cal > max):
  max =cal
 i += 1
 if(i > N):
  print(max)
  break;
#-*-coding:utf-8-*-

def main():
    a, b, n = map(int, input().split())
    if b > n:
        ans = (a * n) // b
    elif b == n:
        ans = (a * (n - 1)) // b
    else:
        ans = (a * b) // b
    print(ans)
    
if __name__ == '__main__':
    main()
A,B,N=input().split();
max=0.0;
A=int(A);
B=int(B);
for x in range(1,int(N)+1):
  ans=int(A*x/B)-A*int(x/B);
  if max<ans:
    max=ans;
print(x);
a, b, n = map(int, input().split())
print(int(a * n / b) - a * int(n / b))
def main():
    a, b, n = [int(e) for e in input().split()]

    if n > b:
        print(a * b // b)
        exit()

    print(a * n // b)


if __name__ == '__main__':
    main()
def floor(num):
    return num // 1


if __name__ == '__main__':
    A, B, N = map(int, input().split())
    ans = 0
    for i in range(min(A + 1, N + 1)):
        val1 = floor(A * i / B) - A * floor(i / B)
        ans = max(ans, int(val1))

    print(ans)
A,B,N = [int(i) for i in input().split()]
x = N
M = A*N//B
ans = -float("inf")

for _ in range(10**6):
    s = A*x//B - A*(x//B)
    ans = max([ans,s])
    x -= 1

print(ans)
import math
a,b,n=map(int,input().split())
if n<b:
    print(math.floor(a*n/b)-a*math.floor(n/b))
else:
    print(a)
from sys import stdin
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
 
ans1 = int((A*N)/B)-A*(N/B)
 
if B-1<=N:
	ans2 = (A*(B-1))//B
else:
  	ans2=0
 
print(max(ans1,ans2))
import math
A,B,N = map(int, input().split())
s=0
x=1
mf=math.floor
while True:
    q=mf(A*x/B)-A*mf(x/B)
    if s<=q:
        s=q
        #print(q)
        x=x+1
        continue
    if s>q:
        print(s)
        break
a, b,n  = map(int, input().split())
from math import floor
if n<b:
    ans =  floor(a*n/b)-a*floor(n/b)

else:
    m = n//b
    m = m*b-1
    ans = floor(a*m/b)-a*floor(m/b)
print(int(ans))
import math
a,b,c=map(int,input().split())

#for i in range(c+1):
d=math.floor(a*c/b)-a*math.floor(c/b)
print(d)


'''

for i in list1:

    if lv[i[1]-1]-lv[i[0]-1]==i[2]:
        #print(lv)
        #print(i)
        sum1+=i[3]


if max<=sum1:
    max=sum1




print(max)
'''
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
for x in reversed(range(N+1)):
    S = int(A * x / B) - A * int(x / B)
    print(x)
    if max<S:
        max = S
    if int(x/B) != 0:
        break
print(max)
import math
a,b,n=map(int, input().split()) 
max = -1000
tmp = 0

for i in range(1,n+1):
    tmp = math.floor(a * i / b) - a * math.floor(i / b)
    if max < tmp:
        max = tmp
    else:
        break

print(max)
import math
A, B, N = map(int, input().split())
t = N // B
if N % B == 0:
    a = max(1, N-1)
    b = N
else:
    a = max(1, t * B - 1)
    b = N

k = A * N // B
if A * N % B == 0:
    case = [a, b, max(min(B-1,N),1)]
else:
    c = max(1,k*B//A+1)
    case = [a,b,c,max(min(B-1,N),1)]

ans = -10**9
for i in case:
    ans = max(ans,math.floor(A*i/B)-A*math.floor(i/B))

print(0)
import math

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

if N < B:
    ans = math.floor((A * N) / B) - A * math.floor(N / B)
    print(ans)
else:
    if B == 1:
        underB = 0
    else:
        underB = math.floor((A * (B - 1)) / B)
    eqB = 0
    eqN = math.floor((A * N) / B) - A * math.floor(N / B)
    print(max(underB, eqB, eqN))
A, B, N = map(int,input().split())
max = 0
x = 0
n = int(B/A)

while(x <= N):
  f = int(A*x/B) - A*int(x/B)
  x += n
  #x += 1
  #print(f)
  if(max <= f):
    max = f
  if(max != 0 and f == 0):
    break
print(max)
import sys,math,copy,queue,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(-1,0),(0,1),(0,-1))

A,B,N = LI()

x = 0
if N <= B:
    x = N
else:
    x = (N // B) * B - 1
ans = int(A*x/B) - A * int(x/B)
print (ans)
#!/usr/bin/env python3
import math
a, b, n = map(int, input().split())
if n > b:
    print(math.floor((a * (b - 1)) / b) - a * math.floor((b - 1) / b))
else:
    print(math.floor((a * n / b) - a * math.floor(n / b)))
import math
l = input().split()
a = int(l[0])
b = int(l[1])
n = int(l[2])
max = 0
calc = 0
for i in range(1, n+1):
  calc = math.floor(a*i / b) - math.floor(i/b)
  if max < calc:
    max = calc
print(calc)
import math

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

if B - 1 <= N:
    x = B - 1
else:
    x = N
    print('h')

ans = math.floor(A * x / B) - A * math.floor(x / B)
print(ans)
def target(x):
    return (A * x) // B - A * (x // B)


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

left = 1
right = N

while right - left > 1:
    mid = (left + right) // 2
    y = target(mid)
    prv = target(mid - 1)
    nxt = target(mid + 1)
    if prv <= y <= nxt:
        left = mid
    else:
        right = mid

if right + 1 <= N and target(right + 1) > target(right):
    print(target(right + 1))
elif right - 1 >= 1 and target(right - 1) > target(right):
    print(target(right - 1))
else:
    print(target(right))
from math import floor
a, b, n = map(int, input().split())
r = floor(n / b)
x = max(r * b - 1, 0)
max_x = floor(a * n / b) - a * floor(n / b)
for i in range(100000):
    if x > 0:
        max_x = max(max_x, floor(a * x / b) - a * floor(x / b))
        x -= b
    else:
        break
max_x = floor(a*(b-1)/b) - a* floor((b-1) / b)
print(max_x)
A, B, N = map(int, input().split())


ans = 0
for x in range(10**5):
  A_x = A * x
  fnc_ = int(A_x / B) - A * int(x / B)
  if fnc_ <= N:
    ans = max(ans, fnc_)

print(fnc_)
import math
A, B, N = map(int, input().split())
 
if N <B:
	print(math.floor(A*N/B))
	exit()
 
if N == B:
	print(0)
	exit()

k = []
 
for i in range (1, int(math.floor(N/B)+1)):
	k.append(i*B-1)
 
k.append(N)
print(k)
 
boom=0
 
for i in range (0, len(k)):
	p = math.floor(A*k[i]/B)-A*math.floor(k[i]/B)
	if p> boom:
		boom = p
 
print(boom)
import math
A,B,N=map(int,input().split())
a,b,x=0,0.1,0
while b>a:
    a=math.floor(A*x/B)-A*math.floor(x/B)
    b=math.floor(A*(x+1)/B)-A*math.floor((x+1)/B)
    x+=1
if N<=x:
    print(math.floor(A*N/B)-A*math.floor(N/B))
else:
    print(a)
import math
a,b,n=map(int,input().split())
c=math.floor((a*n)/b)
print(c)
a,b,n=map(int, input().split())
from math import floor
cand1=floor(a*n/b)-a*floor(n/b)
x=n//b*b-1
if x<0:
    x=n-1
cand2=floor(a*x/b)-a*floor(x/b)
cand1=max(cand2,cand1)

for i in range(1000001):
    n-=1
    if n>=0:
        cand2=floor(a*n/b)-a*floor(n/b)
        cand1=max(cand1,cand2)
    else:
        break
print(cand1)
import math
from math import floor
A,B,N = map(int,input().split())
maxi = 0
Npower = 0
diff = 0
S = N
while S/10 >= 1:
    Npower += 1
    S /=10
if Npower >= 8: 
    for i in range(0,10**6+10**5):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
    for i in range(N-10**6-10**5-10**4-10**3-10**2,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
else:
    for i in range(0,N+1):
        maxi = max(floor((A*i)/B)-A*floor(i/B),maxi)
print(max(maxi+1,0))
import math
A, B, N = map(int, input().split())
t = N // B
if N % B == 0:
    a = max(1, N-1)
    b = N
else:
    a = max(1, t * B - 1)
    b = N

k = A * N // B
if A * N % B == 0:
    case = [a, b, max(min(B-1,N),1)]
else:
    c = max(1,k*B//A)
    case = [a,b,c,max(min(B-1,N),1)]

ans = 0
for i in case:
    ans = max(ans,math.floor(A*i/B)-A*math.floor(i/B))

print(ans)
import math
A, B, N = map(int, input().split())
x = min(N-1, B)
print(math.floor(A*x/B) - A*math.floor(x/B))
import math
a, b, n = map(int, input().strip().split())
if b<n:
    x=n
elif n % b <= n%(b/a):
    x=n-n%b-1
elif (n%b-n%(b/a)+1)<a:
    x=n-n%b-1
else:
    x=n
print(math.floor(a*x/b)-a*math.floor(x/b))
import sys
sys.setrecursionlimit(10**7)
a,b,n = map(int, input().split())

def num(x):
    return (a*x)//b - a*(x//b)

ma = num(1)

for i in range(2, n+1):
    if num(i) > ma:
        ma = num(i)
    else:
        if num(i) >= num(i-1):
            print(ma)
            exit()
print(ma)
a ,b ,n = map(int, input().split())

ans = -1
if(n>100):
    for x in range(n-int(n**(1/2))-1,n+1):
        abc = ((a*x)//b)-(a*(x//b))
        if(ans < abc):
            ans = abc
else:
    for x in range(1,n+1):
        abc = ((a*x)//b)-(a*(x//b))
        if(ans < abc):
            ans = abc


print(ans)
A,B,N =map(int,input().split())
ans = 0
if A > B:
    for i in range(1,N+1):
        tmp = (i*A)//B - A*(i//B)
        if ans == tmp and tmp!=0:
            break
        elif ans <tmp:
            ans=tmp
else:
    for i in range(N,2,-1):
        tmp = (i*A)//B - A*(i//B)
        if ans == tmp and tmp!=0:
            break
        elif ans <tmp:
            ans=tmp
print(ans)
# -*- coding: utf-8 -*-

A, B , N=  [int(i) for i in input().split()]

#if A > B:
print(int(A*N/B) - A*int(N/B))

#else:
import math

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

m = 0
c = 0
if n<b:
    m = math.floor(a*n/b)
else:
    for x in range(b,n+1,b):
        c = math.floor(a*x/b)-a*math.floor(x/b)
        if c >= m:
            m=c
        else:
            break
print(m)
A,B,N = map(int, input().split())
ans = [0]
for t in range(N-1):
    x = t + 1
    ansX = A*x//B-A*(x//B)
    if ansX == max(ans):
        break
    else:
        ans.append(ansX)
print(max(ans))
def solve(a, b, n):
    return (a*n//b - n//b) if a > 1 else 0
assert solve(5, 7, 4) == 2
assert solve(11, 10, 9) == 9

a, b, n = map(int, input().split())
print(solve(a, b, n))
si = lambda: input().strip()
ii = lambda: int(input())
mii = lambda: map(int, input().split())
msi = lambda: map(str, input().split())
lmii = lambda: list(map(int, input().split()))
lmsi = lambda: list(map(str, input().split()))
smii = lambda: sorted(map(int, input().split()))

# ----------

A, B, N = mii()

ans = 0

x = B
ans = max(ans, A*x//B - A*(x//B))
x -= 1
ans = max(ans, A*x//B - A*(x//B))

print(ans)
A,B,N=map(int,input().split())
x=B-1/(1000*A)
if N>=B:
    print(A-1)
else:
    print((A*N//B)-A*(N//B))
import math
A, B, N = list(map(int, input().split(" ")))
res = []

for i in range(N+1):
  r = math.floor(A*i/B) - math.floor(i/B)
  res.append(r)
print(max(res))
import math
a, b, i = map(int, input().split())
q = []
p = math.floor(a*i/b) - a*math.floor(i/b)
q.append(int(p))
print(max(q))
def floor(a):
    return int(a)

if __name__ == '__main__':
    abn = input()
    abn = abn.split()
    a = int(abn[0])
    b = int(abn[1])
    n = int(abn[2])

    max_amount = 0
    for i in range(1,b):
        amount = floor(a*i/b) -a*floor(i/b)
        max_amount = max(max_amount,amount)

    print(max_amount)
import math
A,B,N=map(int,input().split())
han=0
kot=0
i=0
if B-1>=N:
    print(math.floor(A*N/B)-A*math.floor(N/B))
    i=1
else:
    for a in range(B-1,N-5,B):
        if han<(math.floor(A*a/B)-A*math.floor(a/B)):
            han=(math.floor(A*a/B)-A*math.floor(a/B))
            kot=a

if i==0:
    print(han)
a, b, n = [int(i) for i in input().split()]

if n >= a:
  ans = (a*b)//b - a*(b//b)
  print(ans)
  quit()

ans = (a*n)//b - a*(n//b)

print(ans)
a,b,n=map(int,input().split())
ans=0
for x in range(n+1):
  ab=a*x//b-x//b*a
  if n >= ab:
    ans=ab
print(ans)
A,B,N=map(int,input().split())
x=min(B,N)
ans=(A*x)//B
print(max(ans,(A*N)//B - A*(N//B)))
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
print(int((a*(b-1)/b)//1-a*(((b-1)/b)//1)))
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
i_max = 0
i_count = 0

for x in range(1, A[2]+1):
  if i_max < (A[0]*x//A[1]-A[0]*(x//A[1])):
    i_max = (A[0]*x//A[1]-A[0]*(x//A[1]))
    i_count = x
    
print(i_count)
A,B,N=map(int,input().split())
print(int(A*N/B))
A,B,N=map(int,input().split())
f=lambda x:(A*x)//B-A*(x//B)
print(f(B-1 if B-1>=N else N))
def main():
    a, b, n = map(int, input().split())

    if n >= b:
        print(a * n // b - a * (n // b))
    else:
        print(a * n // b)

main()
a, b, n = map(int, input().split())
x = min(n, a)
tmp = x
while 0 < tmp and b != 1:
    tmp -= 1
    if tmp % b == 0 and 0 < tmp:
        x = tmp
if b == 1:
    print(0)
else:
    print(a * x // b)