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):
from math import floor
A, B, N = map(int, input().split())



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


if B - 1 <= N:
    ans = f(B - 1)
else:
    ans = f(N)
print(ans)

Solution (Python):
import math

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

if N >= B-1:
  print(math.floor(A*(B-1)/B))
else:
  print(math.floor(A*N/B))

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

if __name__ == "__main__":
    main()

Solution (Python):

import math
a, b, n = map(int, input().split())
result = 0

if b <= n:
    result = math.floor(a * (b-1)/b) - a * math.floor((b-1)/b)
else:
    result = math.floor(a * n/b) - a * math.floor(n/b)

print(result)

Solution (Python):
a, b, n = list(map(int, input().split()))
if b-1 <= n:
    x = b-1
else:
    x = n
print(int((a*x/b)//1 - 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) - a*math.floor(x/b))

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

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

if b-1 <= n:
  now = b - 1
else:
  now = n
  
print(math.floor(a * now / b) - (a * math.floor(now / 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,n=map(int,input().split())
import math
ans=0
d=min(n,b)
e=b-1
if b>d:
    print(math.floor(a*d/b)-a*math.floor(d/b))
else:
    print(math.floor(a*e/b)-a*math.floor(e/b))

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 <= n:
    print(a * (b - 1) // b)
else:
    print(a * n // b)

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

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

Solution (Python):
import math
a,b,n=[int(x) for x in input().split()]




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

Solution (Python):
from math import floor


def calc(x):
    global a
    global b
    e1 = floor(a * x / b)
    e2 = a * floor(x / b)
    return e1 - e2


a, b, n = map(int, input().split())
if n >= b - 1:
    print(calc(b - 1))
else:
    print(calc(n))

Solution (Python):
from math import floor

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

Solution (Python):
import numpy as np

s=input().split(' ')
A,B,N=int(s[0]),int(s[1]),int(s[2])

def f(x):
    a=np.floor(A*x/B)-A*np.floor(x/B)
    return a.astype(int)

if N<B-1:
    print(f(N))
else:
    print(f(B-1))

Solution (Python):
def func(A, B, x):
    import math
    return math.floor(A * x / B) - A * math.floor(x / B)

def main():
    A, B, N = map(int, input().split())
    n = 1
    if(N < B):
        n = N
    else:
        n = B -1
    print(func(A, B, n))




main()

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

if(b > n):
	p = n
else:
	p = b - 1

ret = int(a*p/b) - a*int(p/b)
print(ret)

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

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

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

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

elif A < B:
    if N < B:
        print(int(A/B*N))
    else:
        print( int(A/B*(B-1)))

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

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

Solution (Python):
import sys
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
a,b,n=I()
ans=0
temp=min(n,b-1)
print(mt.floor((a*temp)/b))

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

if(n >= b-1):
    print(math.floor(a*(b-1)/b))
else:
    print(math.floor(a*n/b))

Solution (Python):



def main():
    a, b, n = map(int, input().split(" "))
    fac = 0
    start = min(b, n)
    if b <= n:
        fac = start - 1
    else:
        fac = start
    ans = a * fac // b - a * (fac // b)
    print(ans)


if __name__ == '__main__':
    main()

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):
import math
a,b,n=map(int,input().split())
if n>=b:
    n=b-1
ans=math.floor(a*n/b)+a*math.floor(n/b)
print(ans)

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

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

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

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

Solution (Python):
import math

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

if B - 1 < N:
    x = B - 1
    v = math.floor((A * x) / B) - A * math.floor(x / B)
else:
    v = math.floor((A * N) / B) - A * math.floor(N / B)

print(v)

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b,n=INTM()
    if b>n:
        print(int(a*n/b)-a*int(n/b))
    else:
        print(int(a*(b-1)/b)-a*int((b-1)/b))
if __name__ == '__main__':
    do()

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):
from math import floor

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

Solution (Python):

import math
A,B,N = map(int, input().split())
result = 0
if(N <= B - 1):
    x = N
else:
    x = B - 1
print(math.floor(x * A / B ) - A * math.floor(x/B))

Solution (Python):
A, B, N = map(int, input().split())
l = -1
r = N



k = min(B-1, N)
ans2 = (A*k)//B - (A*(k//B))

print(ans2)

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

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

Solution (Python):
import math

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


if N < B:
    x = N
elif N == B:
    x = B - 1
elif N > B:
    x = B - 1


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

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

Solution (Python):
from sys import stdin
import math
A,B,N = [int(x) for x in stdin.readline().rstrip().split()]
x = min(N,B-1)
ans = math.floor((A*x)/B) - A*math.floor(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,raw_input().strip().split()))
x=min(n,b-1)
ans=a*x//b
print(ans)

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

A, B, N = map(int, input().split())
a = min(N, B-1)
print(f(a))

Solution (Python):
a, b, n = list(map(int, input().split()))
if a == 1 or b == 1:
    print(0)
    exit()

if b <= n:
    k = n // b
    x = b * k - 1
else:
    x = n

print( (a * x) // b + a * int(x // b) )

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

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

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

print(main())

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

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

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

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

import math

i = B-1


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

Solution (Python):
from math import floor

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

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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



















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

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

c = 0

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

print(math.floor((a*c)/b))

Solution (Python):
import sys
import math
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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


if __name__ == '__main__':
    main()

Solution (Python):
def solve(a, b, n):
    if n >= b - 1:
        return a * (b - 1) // b
    else:
        return a * n // b


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


def test():
    assert solve(5, 7, 4) == 2
    assert solve(11, 10, 9) == 9


if __name__ == "__main__":
    test()
    main()

Solution (Python):



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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    A, B, N = LI()

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

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

if __name__ == '__main__':
    resolve()

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

ans=-float("inf")
i=0

while True:
    x=b*i-1
    i+=1
    if x>n:
        ans=max(int((a*n)/b)-a*int(n/b), ans)
        print(ans)
        break
    if ans<int((a*x)/b)-a*int(x/b):
        ans=int((a*x)/b)-a*int(x/b)
    else:
        print(ans)
        break

Solution (Python):
import math

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

def solve(a, b, n):
    x = min(b -1, n)
    ans = math.floor(a * x / b) - a * math.floor(x / b)
    return ans

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


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


back = []


def backtrack(n, ml, mh, tmp=[]):
    if n == 0:
        back.append(tmp)
        return

    for i in range(ml, mh + 1):
        backtrack(n - 1, i, mh, tmp + [i])


def main():
    A, B, N = inpl()
    if B == 1:
        print(0)
        exit()

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


if __name__ == '__main__':
    main()

Solution (Python):
from math import gcd
a,b,n = list(map(int, input().split()))
ans = a*min(n,(b-1))//b
print(ans)

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(b-1,n)
print(int(a*x/b)-a*int(x/b))

Solution (Python):
import math

a, b, n = map(int, input().split())
k = int((n+1) / b)

if n+1 < b:
  print(int(a*n / b) - a * int(n / b))
else:
  print(a - math.ceil(a / b))

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

if N >= B:
    x = B -1
else:
    x = N
MAX = 0





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

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

Solution (Python):
A, B, N = map(int, input().split())
if N < B:
    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())
"""
ans = 0
tmp = min(b, n)
for x in range(int(pow(n, 0.5)) + 1, n+1):
    
    tmp1 = (a * x) // b - (a * (x // b))
    if tmp1 >= ans:
        ans = tmp1
print(ans)
"""

x = min(b-1, n)

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

Solution (Python):
import math


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


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


if C < B:
    print(GetScore(A, B, C))
else:
    print(GetScore(A, B, B-1))

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



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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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):
from math import floor


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

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


if __name__ == "__main__":
    main()

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())
import math

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

Solution (Python):
def floor(A, B, x):
    return A*x//B - A*(x//B)

A, B, N = list(map(int, input().split()))
C = max(0, B*(N//B) - 1)
print(max(floor(A, B, N), floor(A, B, C)))

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

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

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

Solution (Python):

import math


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

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

    if n >= b:
        print(func(b - 1))
    else:
        print(func(n))

        
submit()

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

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

Solution (Python):
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(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b))

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

if n >= b:
  print(cal(a,b,b-1))
else:
  print(cal(a,b,n))

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

    ans = -1
    for x in [N, B * (N // B) - 1]:
        if x >= 0:
            ans = max(ans, A * x // B - A * (x // B))
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math

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

i = min(b - 1,n)

print(math.floor(a*i*1.0/b)-a*math.floor(i*1.0/b))

Solution (Python):
import sys
input = sys.stdin.readline
A, B, N = map(int, input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors
ps = make_divisors(B - 1)
res = (A * N) // B - A * (N // B)
for i in ps:
  if N < i: continue
  for j in range(1, 10 ** 4 + 1):
    x = i * j
    if N < x: continue
    res = max(res, (A * x) // B - A * (x // B))
for x in range(1, min(N, 10 ** 4)):
  res = max(res, (A * x) // B - A * (x // B))
print(res)

Solution (Python):
a,b,n=map(int,input().split())
x_kouho=[]
count=1
if b==1:
  res=0
else:
  while count<=n//b:
    x_kouho.append(b*count-1)
    count+=1
  if not x_kouho:
    x_kouho.append(n)

  res=0
  for i in range(0,len(x_kouho)):
    keep=x_kouho[i]
    kept=(a*keep)//b-a*(keep//b)
    if kept>res:
      res=kept
print(res)

Solution (Python):
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(math.floor(A * (B-1) / B) - A * math.floor((B-1) / B))

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

if N <= B-1:
  x = N
else:
  x = B-1

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

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

if b == 1:
    print(0)

elif b>n:
    print((a*n)//b)
else:
    print((a*(b-1))//b)

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

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

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

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

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

Solution (Python):
from math import sqrt,floor,ceil

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

if(b>n):
    x=a*n
    print(floor(x/b))
elif(b==n):
    x=a*(n-1)
    x1=floor(x/b)
    y=floor(x/b)-a
    print(max(x1,y))
else:
    x=a*(b-1)
    print(floor(x/b))

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

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

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

if n < b:
    k = n
else:
    k = b-1

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

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

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

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(int(ans))

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

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

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

Solution (Python):
A,B,N = map(int,input().rstrip().split(" "))
x = 0
if B - 1 > N:
    x = N
else:
    x = B - 1
print(int(A * x / B))

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

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

Solution (Python):
import sys,math
def input():
    return sys.stdin.readline()[:-1]
A,B,N = map(int,input().split(' '))

if B<=N:
    print(A*(B-1)//B)
else:
    print(A*N//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())
if n>= b-1:
  ans = (a * (b-1)) // b 
else:
  ans = (a * n) // b
print(ans)

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

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

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

sub = min(b, n)
if b <= n:
    sub -= 1
ans = (a * sub) // b - (a * (sub // b))
print(ans)

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

Solution (Python):
a,b,n=map(int,input().split())
if b==1:print(0);exit()
mul=(n+1)//b
x=max(1,mul*b-1)
print(max((a*x)//b-a*(x//b),(a*n)//b-a*(n//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):
A, B, N = map(int, input().split())

if N < B:
    ans = (A*N)//B
else:
    x = B-1
    v1 = (A*x)//B
    v2 = A*(x//B)
    ans = v1-v2

print(ans)

Solution (Python):



def main():
    A, B, N = map(int, input().split())
    
    if N >= B-1:
        return (A*(B-1))//B - A*((B-1)//B)
    
    return (A*N)//B - A*(N//B)


print(main())

Solution (Python):
import math
def LI():return list(map(int,input().split()))

a,b,n=LI()

def f(x):
    ret=math.floor(a*x/b)-a*math.floor(x/b)
    return ret

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

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

Solution (Python):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




A = None
B = None
N = None

def calc(x):
    return floor(A*x/B) - A * floor(x/B)

def main():
    global A,B,N
    A,B,N = map(int, input().split())
    if B > N:
        return calc(N)
    else:
        
        
        
        
        return calc(B-1)

if __name__ == '__main__':
    print(main())

Solution (Python):

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict

con = 10 ** 9 + 7

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


def main():
	A, B, N = getlist()
	if N < B:
		ans = int(A * N // B)
	else:
		ans = int(A * (B - 1) // B)
	print(ans)

if __name__ == '__main__':
	main()

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



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

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

if n >= b:
  n = (n+1)//b*b-1

print(a*n//b - a*(n//b))

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

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

Solution (Python):
li = list(map(int,input().split()))
a = li[0]
b = li[1]
n = li[2]
if b-1<=n:
    t = b-1
else:
    t=n
print(a*t//b - a*(t//b))

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

a,b,n = map(int,input().split())
if b==1 or a==1:
    print(0)
    exit()
if n<b:
    print(func(a,b,n))
else:
    print(func(a,b,b-1))

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

if __name__=='__main__':
    main()

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 N>=B-1:
  print(int(A*(B-1)/B))
else:
  print(int(A*N/B)-A*int(N/B))

Solution (Python):
import sys
import math
sys.setrecursionlimit(1000000)

def slow_solve(A, B, N):
    ans = 0
    for x in range(1, N+1):
        d = math.floor( (x * A) / B) - A * math.floor(x / B)
        ans = max(ans,d)
    return ans

def solve(A, B, N):
    x = min(N, B - 1)
    d = math.floor( (x * A) / B) - A * math.floor(x / B)
    return d















if __name__ == "__main__":
    A, B, N = tuple(map(int, input().split(" ")))
    print(solve(A, B, N))

Solution (Python):
(A, B, N, ) = [int(n) for n in input().split()]

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

Solution (Python):


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

num=N//B
if num==0:
    n=N
else:
    n=B*num-1


temp1=(A*n)/B//1
temp2=A*((n/B)//1)

print(int(temp1-temp2))

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

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

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

from math import floor
ans=0

if b>n:
    x=n
    print(floor(a*x/b)-a*floor(x/b))
    exit()
cnt=0    
for x in range(b-1,n+1,b):
    tmp=floor(a*x/b)-a*floor(x/b)
    ans=max(ans,tmp)
    cnt+=1
    if cnt>10**7:
        break
print(ans)

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

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

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

x=b-1
if x<=n:
  c=int(a*x/b)
  d=4*int(x/b)
  print(c-d)
else:
  c=int(a*n/b)
  d=4*int(n/b)
  print(c-d)

Solution (Python):


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

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

x = min(b-1,n)
print(floor(x))

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

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

Solution (Python):

from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce


MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def main():
    a, b, n = [int(x) for x in stdin.readline().rstrip().split()]
    if n >= b:
        print((a*(b-1))//b)
    else:
        print((a*n)//b)
main()

Solution (Python):

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

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

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

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

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

Solution (Python):
import math

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

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

ans = math.floor(c*a/b)-a*(math.floor(c/b))
print(ans)

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

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

Solution (Python):
x, y, z = map(int, input().split())
if y - 1 >= z:
	print((x * z) // y - x * (z // y))
else:
	w = (z // y) * y - 1
	print(max((x * w) // y - x * (w // y), (x * z) // y - x * (z // y)))

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

Solution (Python):
import math
v = list(map(int, input().split()))
a, b, n = v[0], v[1], v[2]
if n <= b - 1:
	print(math.floor((a * n) / b))
else:
	print(math.floor((a * (b - 1)) / b))

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

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



    


if __name__ == "__main__":
    resolve()

Solution (Python):


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

num=N//B
if num==0:
    n=N
else:
    n=B*num-1


temp1=(A*n)/B//1
temp2=A*((n/B)//1)

print(int(temp1-temp2))

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

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

print(int(a*x/b))

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

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

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

Solution (Python):
from sys import stdin
import math
import fractions

a, b, n = [int(x) for x in stdin.readline().rstrip().split()]

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

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