Problem:
 Score : 400 points    Problem Statement Given are integers A , B , and N .  Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N .  Here floor(t) denotes the greatest integer not greater than the real number t .      Constraints  1 ≤ A ≤ 10^{6}  1 ≤ B ≤ 10^{12}  1 ≤ N ≤ 10^{12}  All values in input are integers.         Input Input is given from Standard Input in the following format:  A  B  N       Output Print the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N , as an integer.        Sample Input 1 5 7 4      Sample Output 1 2  When x=3 , floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2 . This is the maximum value possible.       Sample Input 2 11 10 9      Sample Output 2 9

Solution (Python):
import math
a, b, n = map(int, input().split())
if b > n:
    print(math.floor(a*n/b))
elif b <= n:
    print(math.floor(a*(b-1)/b))

Solution (Python):
a, b, n = map(int, input().split(' '))
r = min(b-1, n)
c = int(a*r/b) - a*int(r/b)
print(c)

Solution (Python):
a, b, n = map(int, input().split())
m = max(0,(n//b)*b-1)
val = max((a*n)//b - a*(n//b), (a*m)//b - a*(m//b))
print(val)

Solution (Python):
import math
A, B, N = map(int, input().split())


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


print(f(min(B-1, N)))

Solution (Python):
A, B, N = map(int, input().split())
print(A * min(B-1, N) // B)

Solution (Python):
A,B,N = map(int, input().split())
if B == 1 or A == 1:
  floor = 0
else:
  if N < B:
    floor = int(A*N/B) - A*int(N/B)
  elif N == B:
    floor = int(A*(N-1)/B) - A*int((N-1)/B)
  else:
    floor = max([(int(A*(x-1)/B) - A*int((x-1)/B)) for x in range(B,N,B)])
    
print(floor)

Solution (Python):
import math

n = list(map(int,input().split()))
x = min(n[1]-1 , n[2])
if n[2] >= n[2]:
    print(math.floor(n[0] * x / n[1]))

Solution (Python):
[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(max(out1,out2))

Solution (Python):
[A,B,N] = list(map(int,input().split()))

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

out1 = int(A*X/B) - A*int(X/B)
out2 = int(A*Y/B) - A*int(Y/B)
print(out2)

Solution (Python):

def m():
    return map(int, input().split())

A, B, N = m()

if N >= B:
    print(int(A * (B-1) / B))
else:
    print(int(A * (N) / B))

Solution (Python):
A, B, N = map(int, input().split())
x = min(N, B-1)
print(A*x//B - A*(x//B))

Solution (Python):
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))

Solution (Python):
a, b, n = map(int, input().split())
def f(x):
  return (a*x)//b - a*(x//b)
 
print(f(min(b-1, n)))

Solution (Python):
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()

Solution (Python):
import sys
import math
from pprint import pprint

A, B, N = map(int, sys.stdin.readline().strip().split())

def func(x):
    return math.floor(A*x/B) - A*math.floor(x/B)
    

print(func(min(B-1, N)))

Solution (Python):
import sys
import math
from pprint import pprint

A, B, N = map(int, sys.stdin.readline().strip().split())

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

print(func(min(B-1, N)))

Solution (Python):
import math
A, B, N = map(int, input().split())

num = math.floor(A*min(B-1,N)/B) - A*math.floor(min(B-1,N)/B)

print(num)

Solution (Python):
import sys
import math
from pprint import pprint
 
A, B, N = map(int, sys.stdin.readline().strip().split())
 
def func(x):
    return A*x//B - A*(x//B)
 
 
right = N
left = 0
while right - left > 5:
    mid_left = right//3+left*2//3
    mid_right = right*2//3+left//3
    
    if mid_left == mid_right:
        break
    
    if func(mid_left) <= func(mid_right):
        left = mid_left
    else:
        right = mid_right
    
 
ans = -1 * float("inf")
for i in range(left, right+1):
    
    ans = max(ans, func(i))
print(ans)

Solution (Python):
import sys
import math
from pprint import pprint

A, B, N = map(int, sys.stdin.readline().strip().split())

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


right = N
left = 0
while right - left > 5:
    mid_left = right//3+left*2//3
    mid_right = right*2//3+left//3
    
    
    
    
    if func(mid_left) <= func(mid_right):
        left = mid_left
    else:
        right = mid_right
    

ans = -1 * float("inf")
for i in range(left, right+1):
    
    ans = max(ans, func(i))
print(ans)

Solution (Python):
a,b,n = map(int,input().split())
if b-1 > n:
  k = n/b
else:
  k = (b-1)/b
print(int(a*k))

Solution (Python):
import math
A, B, N = map(int, input().split())
x=N
if N>B-1:
    x=B-1
print(math.floor(A*x/B)-A*math.floor(x/B))

Solution (Python):
from sys import stdin
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
 
ans1 = ((A*N)//B)-A*int(N/B)
 
if B-1<=N:
	ans2 = (A*(B-1))//B
else:
  	ans2=0
 
print(max(ans1,ans2))

Solution (Python):
from sys import stdin
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]
 
ans1 = (A*N)//B-A*(N//B)
 
if B-1<=N:
	ans2 = (A*(B-1))//B
else:
  	ans2=0
 
print(max(ans1,ans2))

Solution (Python):
import math
a,b,n=map(int,input().split())
c=min(b-1,n)
f=math.floor(a*c/b)
print(f)

Solution (Python):
import math
A,B,N = (int(x) for x in input().split())
a = (N//B)*B-1
if a < 0:
  a = 0
  ans = (A*a)//B - A*math.floor(a/B)
else:
  ans = (A*a)//B - A*math.floor(a/B)

if ans < (A*N)//B - A*math.floor(N/B):
  re = (A*N)//B - A*math.floor(N/B)
else:
  re = ans
print(re)

Solution (Python):
A, B, N = [int(x) for x in input().split()]
max_val = 0
j = min(B-1,N)
x = (A*j)//B - A*(j//B)
print(x)

Solution (Python):
a,b,n=map(int,input().split())
print(a*min(n,b-1)//b)

Solution (Python):
a,b,n=map(int,input().split())
print(a*min(n,b-1)//b)

Solution (Python):
a,b,n=map(int,input().split())
x=min(n,b-1)
print(a*x//b-x//b*a)

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


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


print(f(min(n, b-1)))

Solution (Python):
def f(x):return a*(x%b)//b-(a*x)%b//b
a,b,n=map(int,input().split())
print(f(min(n,b-1)))

Solution (Python):
import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

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

if A*N < B:
    print(0)
    exit()

if N < B:
    print((A*N)//B - A*(N//B))
    exit()

aa = N//B
x = aa*B - 1
res = (A*x)//B - A*(x//B)

print(res)

Solution (Python):
from sys import stdin
import sys
 
A, B, N = [int(x) for x in stdin.readline().rstrip().split()]


ans = int((A*N)/B)-A*int(N/B)
ans2=0
if B-1<N:
	ans = int((A*(B-1))/B)-A*int((B-1)/B)
else:
  	ans2=0
    
 
 
print(ans)

Solution (Python):
a, b, n = map(int, input().split()) 
if b == 1 or a == 1: 
    print(0) 
else: 
    r = min(b-1, n) 
    s = (a * r) // b - a * (r // b)    
    print(s)

Solution (Python):
a, b, n = map(int, input().split())
start = min(b - 1, n)
def f(x):
    return int(a * x / b) - a * int(x / b)
print(f(start))

Solution (Python):
import math
A, B, N = map(int, input().split())
print(math.floor(A * min(B - 1, N) / B))

Solution (Python):
import sys
readline = sys.stdin.readline

def main():
    A, B, N = map(int, readline().rstrip().split())
    x = min(B-1, N)
    ans = (A * x) // B - A * (x // B)
    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(8*(10**6)):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)

resolve()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(5*(10**6)):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)

resolve()

Solution (Python):
import sys
input = sys.stdin.readline
import math
def main():
    A, B, N = map(int, input().split())
    x = min(N, B-1)
    ans = math.floor(A*x/B) - A * math.floor(x/B)
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
a, b, n = map(int, input().split())
x = min(b - 1, n)
ans = (a * x) // b - a * (x // b)
print(ans)

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


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


print(f(min(n, b-1)))

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(10**6):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)

resolve()

Solution (Python):
import math
A,B,N=map(int,input().split())

a=min(B,N)

if a==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))

Solution (Python):
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 = a*m//b-a*floor(m/b)
print(ans)

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

import random
def resolve():
    A,B,N=pin()
    def f(A,B,x):
        t=(A*x)//B
        s=x//B
        return t-A*s
    ans=0
    for i in range(10**6):
        k=random.randint(0,N)
        ans=max(ans,f(A,B,k))
    print(ans)

resolve()

Solution (Python):
A, B, N = list(map(int, input().split()))
def function(a, b, x):
  return (a*x)//b - a*(x//b)
print(max([function(A, B, N), function(A, B, max([1, N-N%B-1]))]))

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

if n<b:
    ans =  (a*n)//b-a*(n//b)

else:
    m = int(n//b)
    m = m*b-1
    ans = (a*m)//b-a*(m//b)
print(ans)

Solution (Python):
a,b,n = map(int,input().split())
if( n >= b):
    x = b-1
else:
    x = n

ans = int( a*(x/b - int(x/b) ) )
print(ans)

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

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

print(f(min(b-1, n)))

Solution (Python):
a,b,n = map(int,input().split(" "))
n = min(b-1,n)
temp1 = (a * n)//b
temp2 = (n)//b
temp3 = a*temp2
print(temp1 - temp3)

Solution (Python):
import sys

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

if A == 1 or B == 1:
    print(0)
    sys.exit()

i = 0
x = 0
mx = 0

while(x < min(A*B, N)):
    pt = (A * x) // B - A * (x // B)
    mx = max(mx, pt)
    i += 1
    x = i * (B-1)
    
last = (A * N) // B - A * (N // B)
mx = max(mx, last)
print(mx)

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





def solve(i):
    a = int(A * i / B)
    b = A * int(i / B)
    return a - b


print(solve(min(N, B - 1)))

Solution (Python):
import sys,bisect,string,math,time,functools,random
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            a,b,c=(inp+[1])[:3]
            org_inp.append(inp)
        else:
            index=0
            a,b,c=(ls[i]+[1])[:3]
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'

    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase

input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

class Tree:
    def __init__(self,inp_size=None,init=True):
        if init:
            self.stdin(inp_size)
        return

    def stdin(self,inp_size=None):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1)
        return
    
    def listin(self,ls):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls)
        return

    def __str__(self):
        return  str(self.edges)

    def dfs(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append(x)
        v=[-1]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==-1:
                    q.append(nb)
                    v[nb]=func(v[c],nb,d)
        return v

    def EulerTour(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append((-1,x))
        v=[None]*self.size
        v[x]=root_v
        et=[]
        while q:
            cb,ce=q.pop()
            et.append(ce)
            for nb,d in self.edges[ce]:
                if v[nb]==None:
                    q.append((nb,ce))
                    q.append((ce,nb))
                    v[nb]=func(v[ce],nb,d)
        vid=[[-1,-1]for i in range(self.size)]
        for i,j in enumerate(et):
            if vid[j][0]==-1:
                vid[j][0]=i
            else:
                vid[j][1]=i
        return v,et,vid
    
    def LCA_init(self,depth,et):
        self.st=SegTree(self.size*2-1,func=min,ide=inf)
        for i,j in enumerate(et):
            self.st.update(i,j)
        self.LCA_init_stat==True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            depth,et,vid=self.EulerTour(root)
            self.LCA_init(depth,et)
        return self.st.query(x,y+1)

show_flg=False
show_flg=True

ans=0

a,b,n=LI()
r=min(b-1,n)
ans=math.floor(a*r/b)
print(ans)

Solution (Python):

def main():
    A, B, N = map(int, input().split())
    f = lambda x: (A * x) // B - A * (x // B)
    print(f(min(B - 1, N)))


if __name__ == "__main__":
    main()

Solution (Python):
import math
A,B,N = list(map(int, input().split()))

x = min(N, B-1)

print(math.floor(A * x / B) - A * math.floor(x / B))

Solution (Python):
a, b, n = map(int, input().split())
start = min(b - 1, n)
def f(x):
    return int(a * x / b) - a * int(x / b)
print(f(start))

Solution (Python):
a, b, n = map(int, input().split())
start = min(b - 1, n)
def f(x):
    return int(a * x / b) - a * int(x / b)
print(f(start))

Solution (Python):
from statistics import median


from fractions import gcd
from itertools import combinations 
from collections import deque
from collections import defaultdict
import bisect










import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    from math import floor
    a,b,n = readInts()

    p = min(b-1,n)
    
    print(floor(a*p/b) - a*floor(p/b))


if __name__ == '__main__':
  main()

Solution (Python):
import sys
A,B,N=map(int,input().split())
X=B-1
X=min(B-1,N)
ans=(A*X)//B-A*(X//B)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

a,b,n = (int(x) for x in input().split())
n = min(b-1,n)
ans = (a*n/b) - a*(n/b)
print(ans)

Solution (Python):

import math
a, b, n = map(int, input().split())
x = min(b-1, n)
print(math.floor((a*x)/b) - a * math.floor(x/b))

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

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

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

x = min(b - 1, n)

max_num = a * x // b - (a * (x // b))
print(max_num)

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

x = min(b - 1, n)

max_num = (a * x) // b - (a * (x // b))
print(max_num)

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

x = min(b - 1, n)

max_num = (a * x) // b - a * (x // b)
print(max_num)

Solution (Python):
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)


inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from operator import itemgetter
from collections import defaultdict
import sys
import math
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))



def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a




def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def floor(a, b):
    """floor(a/b) 整数値を返す"""
    c = (a - a % b)/b
    return int(c)


def main():
    a, b, n = wi()
    if n >= b-1:
        print(floor(a*(b-1), b) - a*floor((b-1), b))
    else:
        print(floor(a*n, b) - a*floor(n, b))


if __name__ == '__main__':
    main()

Solution (Python):
import math
a,b,n = map(int,input().split())
x = min(b-1,n)

print(math.floor((a*x)/b) - (a)*(math.floor(x/b)))

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

if N < B:
    print((A * N)//B)
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))

Solution (Python):
i = list(map(int, input().split()))
A = i[0]
B = i[1]
N = i[2]
if N < B-1:
    print(A * N // B)
else:
    print(A * (B-1) // B)

Solution (Python):
import math

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

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

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    A,B,N=MI()
    y = (N+1)//B
    x = y*B-1
    x = min(x,N)    

    def f(x):
        return (A*x)//B - A*(x//B)
    if(x<0):
        print(f(N))
    else:
        print(f(x))
    
if __name__ == '__main__':
    main()

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

    x = min(B - 1, N)

    ans = (A * x // B) - A * (x // B)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input().split()

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

n = (N // B) * B - 1
if (n < 0):
  n = 0

a = (A*N)//B - A*(N//B)
b = (A*n)//B - A*(n//B)
"""
for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
"""
    
if (a > b):
  result = a
else:
  result = b
print(result)

Solution (Python):
a,b,n = map(int, input().split())
def f(x):
    return int(a*x/b) - a*int(x/b)
Max = f(min(b-1,n))
print(Max)

Solution (Python):
A,B,N = map(int, input().split())
x = min(N, B-1)
d = x/B - int(x/B)
ans = int(A*d)
print(ans)

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

Solution (Python):
import sys
from math import floor

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


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

x = min(B-1, N)

ans = floor((A * x) / B) - A * floor(x/B)

print(ans)

Solution (Python):
import math

A, B, N = map(int, input().split(' '))
x = min(B, N + 1) - 1
print(math.floor((A * x) / B) - A * (math.floor(x / B)))

Solution (Python):
import math

A, B, N = map(int, input().split(' '))
ans = 0
x = min(B, N + 1) - 1
ans = math.floor((A * x) / B) - A * (math.floor(x / B))
print(int(ans))

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

n = min(B-1,N)

ans = (A*n)//B
print(ans)

Solution (Python):
import math

def floor(num,a,b):
    return math.floor(a*num/b)-(a*math.floor(num/b))

a,b,n = map(int,input().split())
print(floor(min(b-1,n),a,b))

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

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

print((a* x) // b)

Solution (Python):
import math
a, b, n = map(int, input().split())
x = min(b-1,n)

print(math.floor(a* (x%b) / b))

Solution (Python):
import math
a, b, n = map(int, input().split())

if b <= n:
  if n != 1:
    n = b - 1

ans1 = math.floor((a * n) / b)
ans2 = a * math.floor(n / b)
ans3 = ans1 - ans2

print(ans3)

Solution (Python):

from math import floor

a, b, n = map(int, input().split())
x = n if b > n else b-1
print(floor(a*x/b)-a*floor(x/b))

Solution (Python):
a,b,n=map(int,input().split())
if n<=b-1:
    x=n
else:
    x=b-1
print((a*x//b)-a*(x//b))

Solution (Python):
A,B,N=map(int,input().split())
if(N>=B-1):
    x=B-1
if(N<B-1):
    x=N
ans=int(A*x/B)-A*int(x/B)
print(ans)

Solution (Python):
import math
A, B, N = map(int, input().split())

x = N

if (N >= B-1): x = B-1
ans = A*(x%B)//B

print(ans)

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

x = min(B-1, N)

ans = int(A*x/B) - A*int(x/B)

print(ans)

Solution (Python):
a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b-a*(x//b))

Solution (Python):
a,b,n = list(map(int, list(input().split(' '))))
x = n
if (n>=b-1):
    x = b-1
ans = a*x//b - a*(x//b)
print(ans)

Solution (Python):
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Solution (Python):
A,B,N = map(int, input().split())
if B > N:
    res = (A*N//B)-A*(N//B)
else:
    N = N - N%B - 1
    res = (A*N//B)-A*(N//B)
print(res)

Solution (Python):

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

num = min(B-1, N)

print(A * num // B - A * (num // B))

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

def calc(a,b,x):
  return ((a * x) // b) - (a * (x // b))

print(calc(A,B,min(B-1,N)))

Solution (Python):
a,b,n=map(int,input().split())
x=0
if n>b-1:
    x=b-1
else:
  x=n
ans=int(a*x/b)-a*int(x/b)
print(ans)

Solution (Python):
A,B,N=list(map(int, input().split()))


i=min(N,B-1)
print(int(A*i/B))

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

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

print(ans)

Solution (Python):
a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b)

Solution (Python):
def func(x) :
    global a,b;
    return (a*x)//b-a*(x//b);

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

if n < b :
    print(func(n));
else :
    print(func(b-1));

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

if a==1:
  print(0)
else:
  c = min(b-1, n)
  print((a*c)//b)

Solution (Python):
a,b,n=map(int,input().split())
x = min(b-1,n)
print(int(a*x/b)-a*int(x/b))

Solution (Python):
(a, b, c)=[int(x) for x in input().split()]
print((a*(b-1)//b)-a*((b-1)//b) if b-1 < c else (a*c//b)-a*(c//b))

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

Solution (Python):
(a, b, c)=[int(x) for x in input().split()]
if b-1 < c:
  print((a*(b-1)//b)-a*((b-1)//b))
elif b-1 >= c:
  print((a*c//b)-a*(c//b))

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

x = min(n, b-1)
ans = a * x // b - a * (x // b)

print(ans)

Solution (Python):

import math
a,b,n = map(int,input().split())
x = min(b-1,n)
ans = math.floor(a*x//b)-a*math.floor(x/b)
print(ans)

Solution (Python):
a,b,n=map(int,input().split())
if b>n:
    print((a*n)//b-(a*(n//b)))
else:
    print((a*(b-1))//b-(a*((b-1)//b)))

Solution (Python):
a, b, n = map(int, input().split())
def cal(x):
    return (a*x)//b - a*(x//b)
print(cal(min(b-1,n)))

Solution (Python):
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.floor(A*x/B)-A*math.floor(x/B)
print(ans)

Solution (Python):

import math
ii = lambda:int(input())
li = lambda:list(map(int,input().split()))

def main(a,b,n):
    x = min(b-1,n)
    return calc(a,b,x)

def calc(a,b,x):
    return math.floor(a*x/b) - a*math.floor(x/b)

a,b,n = li()
print(main(a,b,n))

Solution (Python):
def d_floor_function():
    A, B, N = [int(i) for i in input().split()]
    return (lambda x: ((A * x) // B) - A * (x // B))(min(B - 1, N))

print(d_floor_function())

Solution (Python):
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:
        ans = cal(A,B,B-1)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import math
abn = list(map(int,input().split()))

x = min(abn[1] - 1, abn[2])
m = math.floor(abn[0] * x / abn[1]) - abn[0] * math.floor(x / abn[1])
print(m)

Solution (Python):
from math import floor

def f(x):
  return floor(a*x/b) - a*floor(x/b)

a,b,n = map(int,input().split())    
print(f(min(b-1,n)))

Solution (Python):
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Solution (Python):
a,b,n = map(int,input().split())
print(min(b-1, n)*a//b)

Solution (Python):
a,b,n=map(int,input().split())
def f(x):
    return a*x//b-a*int(x/b)
if n<b:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Solution (Python):
a,b,n=map(int,input().split())
def f(x):
    return int(a*x//b)-a*int(x//b)
if n<b:
    print(f(n))
elif n==b:
    print(f(n-1))
elif n>b:
    t = n
    u = n - (n%b+1)
    print(max(f(t),f(u)))

Solution (Python):
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = A*N // B - A*math.floor(N/B)
print(ans)

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

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

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

Solution (Python):
a,b,n=map(int,input().split())
def f(x):
    return a*x//b-a*int(x//b)
if n<b:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

Solution (Python):
A, B, N = map(int, input().split())
 
def f(x):
    return (A*x)//B-A*(x//B)
 
X = N
Y = min(B-1,N)
 
print(max(f(X),f(Y)))

Solution (Python):
import sys
input = sys.stdin.readline

import math

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

    if b > n:
        print(math.floor(a*n/b))

    else:
        print(math.floor(a*(b-1)/b) - a*math.floor((b-1)/b))

if __name__ == '__main__':
    main()

Solution (Python):
a,b,n=map(int,input().split())
def f(x):
    return a*x//b-a*(x//b)
if n<b:
    ans =f(n)
else:
    t = n
    u = b - 1
    ans=max(f(t),f(u))
print(ans)

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


x=min(b-1,n)

print(a*x//b)

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

x = min(n, b-1)
left = int(a * x / b)
right = a * int((x / b))

print(left - right)

Solution (Python):
import math
a, b, n = map(int, input().strip().split())
x=min(b-1,n)
print(math.floor(a*x/b)-a*math.floor(x/b))

Solution (Python):
a,b,n = map(int,input().split())
 
if n<b:
  maxq = n
else:
  maxq = b-1
  
ans = a*maxq//b
 
print(ans)

Solution (Python):
import math
def f(x):
    return math.floor(a*x/b) - a*math.floor(x/b)

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

if b-1<=n:
    ans=f(b-1)
    print(ans)
else:
    ans=f(n)
    print(ans)

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

x = b - 1
x = min(x,n)
print(x*a//b)

Solution (Python):
a, b, n = map(int, input().split())
if n < b:
	print(int(a*n/b))
else:
	print(int(a*(b-1)/b))

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

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

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

print(max(f(X),f(Y)))

Solution (Python):
import sys

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

if (N>=2*B-1):
    n=B-1
elif (B<=N<2*B-1):
    n=max(N-B,B-1)
else:
    n=N

print(int(A*n/B))

Solution (Python):
A, B, N = map(int, input().split())
from math  import floor

def f(A, B, N):
    return floor(A*N/B)-A*floor(N/B)


print(f(A, B, min(B-1, N)))