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-----
5 7 4

-----Sample Output-----
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.

Difficulty: MEDIUM_HARD

Solutions:
(a, b, n) = map(int, input().split())
k = max(0, (n - b + 1) // b)
k = min(n, k * b + b - 1)
print(a * k // b - a * (k // b))


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)))


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


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


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


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


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


(A, B, N) = [int(_) for _ in input().split()]
i = min(N, B - 1)
ans = A * i // B - A * (i // B)
print(ans)


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


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

def __starting_point():
	main()
__starting_point()


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


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


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


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


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


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


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


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


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


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


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


import sys
from collections import deque, Counter, defaultdict
import bisect
import heapq
import math
import itertools
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
inf = 10 ** 18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
mod = 998244353
(a, b, n) = rl()
if n / b >= 1:
	print(math.floor(a * (b - 1) / b))
else:
	print(math.floor(a * n / b))


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

def f(a, b, x):
	return a * x // b - a * (x // b)
print(f(a, b, min(b - 1, n)))


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


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


import math

def __starting_point():
	(a, b, n) = list(map(int, input().split()))
	ans = 0
	lp = min(b - 1, n)
	ans = math.floor(a * lp / b) - a * math.floor(lp / b)
	print(ans)
__starting_point()


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


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


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


(a, b, n) = map(int, input().split())
m = 0
x = min(n, b - 1)
r = x // b
d = x / b - r
print(int(a * d))


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


def main():
	import sys
	pin = sys.stdin.readline
	pout = sys.stdout.write
	perr = sys.stderr.write
	(A, B, N) = list(map(int, pin().split()))
	x = min(B - 1, N)
	ans = int(A * x / B) - A * int(x / B)
	print(ans)
	return
main()


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


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


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

def __starting_point():
	main()
__starting_point()


import sys
from itertools import chain

def solve(A: int, B: int, N: int):
	if N >= B:
		x2 = B - 1
	else:
		x2 = N
	return A * x2 // B

def main():
	tokens = chain(*(line.split() for line in sys.stdin))
	A = int(next(tokens))
	B = int(next(tokens))
	N = int(next(tokens))
	answer = solve(A, B, N)
	print(answer)

def __starting_point():
	main()
__starting_point()


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


import numpy as np
(a, b, n) = map(int, input().split())
if b - 1 <= n:
	value = np.floor(a * (b - 1) / b) - a * np.floor((b - 1) / b)
else:
	value = np.floor(a * n / b) - a * np.floor(n / b)
print(int(value))


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


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


(A, B, N) = map(int, input().split())
from decimal import Decimal
A = Decimal(A)
B = Decimal(B)
i = min(B - 1, N)
print(int(A * i / B) - A * (i // B))


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


(A, B, N) = [int(i) for i in input().split()]
t = min([N, B - 1])
print(A * t // B)


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, bisect
import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
nf = lambda : float(ns())
na = lambda : list(map(int, stdin.readline().split()))
nb = lambda : list(map(float, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
(A, B, N) = na()
if N >= B - 1:
	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))


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


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


(A, B, N) = (int(_) for _ in input().split())
x = min(N, B - 1)
print(A * x // B)


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


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


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


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


import math

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

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


import sys

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

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

def __starting_point():
	main()
__starting_point()


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


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


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


(a, b, n) = map(int, input().split())
x = min(n, b - 1)
l = a * x // b
r = a * (x // b)
print(l - r)


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


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


from math import floor
(A, B, N) = map(int, input().split())
f = lambda x: floor(A * x / B) - A * floor(x / B)
if A == 1 or B == 1:
	print(0)
	return
if N < B:
	print(f(N))
	return
print(f(B - 1))


(A, B, N) = [int(n) for n in input().split()]
print(int(A * min(N, B - 1) / B))


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


import bisect, collections, copy, itertools, math, string
import sys

def I():
	return int(sys.stdin.readline().rstrip())

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

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

def LS():
	return list(sys.stdin.readline().rstrip().split())

def main():
	(a, b, n) = LI()
	ans = 0

	def f(a, b, x):
		ans = a * x // b - a * (x // b)
		return ans
	if b - 1 <= n:
		ans = f(a, b, b - 1)
	else:
		ans = f(a, b, n)
	print(ans)
main()


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


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


import math
import decimal
(a, b, n) = map(int, input().split())
if b <= n:
	x = decimal.Decimal(a * (b - 1) / b)
	c = math.floor(x)
	print(c)
else:
	x = decimal.Decimal(a * n / b)
	c = math.floor(x)
	print(c)


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


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


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


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


(a, b, N) = [int(x) for x in input().split()]
print(a * min(b - 1, N) // b)


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


[A, B, N] = [int(i) for i in input().split()]
u = 0
s = float('inf')
if B - 1 <= N:
	t = A * (B - 1) // B - A * ((B - 1) // B)
else:
	u += 1
if 2 * B - 1 <= N:
	s = A * (2 * B - 1) // B - A * ((2 * B - 1) // B)
else:
	u += 1
print(min(s, t) if u != 2 else A * N // B - A * (N // B))


import math
import collections
import itertools
import copy

def YesNo(Bool):
	if Bool:
		print('YES')
	else:
		print('NO')
	return

def resolve():
	(A, B, N) = list(map(int, input().split()))
	X = min(N, B - 1)
	ans = math.floor(A * X / B)
	print(ans)
resolve()


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


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


def solve(A, B, N):
	x = min(B - 1, N)
	a = A * x // B - A * (x // B)
	return a
(A, B, N) = list(map(int, input().split()))
print(solve(A, B, N))


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


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


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


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


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


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


import math
import sys
input = sys.stdin.readline

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


def abc165d_floor_function():
	(a, b, n) = map(int, input().split())
	i = min(n, b - 1)
	max_val = a * i // b - a * (i // b)
	print(max_val)
abc165d_floor_function()