CodeEff/ECCO huggingface dataset:
# Original solution
import math
from collections import Counter
n = int(eval(input()))
lis = list(map(str,input().split()))
if n % 2 == 1:
  for i in range(math.ceil(n / 2)):
    if i == 0:
      if lis.count("0") != 1:
        print("0")
        exit()
    else:
      if lis.count(str(i * 2)) != 2:
        print("0")
        exit()
  print((2 ** (math.floor(n/2))))
else:
  for i in range(n//2):
    if lis.count(str(i * 2 + 1)) != 2:
      print("0")
      exit()
  print((2 ** (n//2)))

# Optimized solution
import math
n = int(eval(input()))
lis = list(map(int,input().split()))
li = [0 for _ in range(math.ceil(n / 2))]

for i in range(n):
  li[math.floor(lis[i] / 2)] += 1
for i in range(len(li)):
  if n % 2 == 1 and i == 0:
    if li[i] != 1:
      print("0")
      exit()
  else:
    if li[i] != 2:
      print("0")
      exit()
cou = 1
for i in range(math.floor(n/2)):
  cou *= 2
  cou %= (10 ** 9 + 7)
print(cou)
# Original solution
from collections import Counter
n = int(eval(input()))
lis = list(map(int,input().split()))
if n % 2 == 0:key = 1
else:key = 2
for i in range(n//2):
    if lis.count(i*2+key) != 2:
        print("0")
        exit()
if n % 2 == 1:
    if lis.count(0) != 1:
        print("0")
        exit()
print((2 ** (n//2)))

# Optimized solution
n = int(eval(input()))
lis = list(map(int,input().split()))
lis.sort()
if n % 2 == 1:
    if lis[0] != 0:
        print("0")
        exit()
    else:key = 0
else:key = -1
for i in range(n//2):
    if lis[i*2+key+1] != lis[i*2+key+2] or lis[i*2+key+2] != 2*(i+1) + key:
        print("0")
        exit()
ans = 1
for i in range(n//2):
    ans *= 2
    ans %= 10 ** 9 +7
print(ans)
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
A.sort()
B=[]#偶数だけ
C=[]#奇数だけ

if N%2==0:
  for i in range(0,int(N/2)):
    B+=[2*i,2*i]
    C+=[2*i+1,2*i+1]
  if A==B or A==C:
    n=int(N/2)
    ans=2**n
    print((ans%(10**9+7)))
  else:
    print((0))
else:
  B+=[0]
  C+=[1]
  for i in range(0,int(N/2)):
    B+=[2*i+2,2*i+2]
    C+=[2*i+3,2*i+3]
  if A==B or A==C:
    n=int((N-1)/2)
    ans=2**n
#    ans=2**((N-1)/2)
    print((ans%(10**9+7)))
  else: 
    print((0))

# Optimized solution
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

MOD = 10**9+7
N = int(eval(input()))
A = list(map(int, input().split()))

A.sort()
if N%2:
  correct = [0]
  for i in range(N//2):
    correct += [(i+1)*2]*2
else:
  correct = []
  for i in range(N//2):
    correct += [i*2+1]*2
    
if A == correct:
  print((power_func(2, N//2, MOD)))
else:
  print((0))
# Original solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

if N % 2 == 1:
    for i in range(N // 2):
        if A.count(i * 2) != 2 and i != 0:
            print((0))
            exit()
        if i == 0 and A.count(i) != 1:
            print((0))
            exit()

if N % 2 == 0:
    for i in range(N // 2):
        if A.count(i * 2 + 1) != 2:
            print((0))
            exit()

print((2 ** (N // 2)))


# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

check = True
A = sorted(A)
if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0 and A[i] != i + 1:
            check = False
        if i % 2 == 1 and A[i] != i:
            check = False

if N % 2 != 0:
    for i in range(N):
        if i % 2 == 0 and A[i] != i:
            check = False
        if i % 2 == 1 and A[i] != i + 1:
            check = False

if check:
    print(((2 ** (N // 2)) % (10 ** 9 + 7)))
else:
    print((0))
# Original solution
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort()
    if a[0] == 0:
        t = 2
        for i in range(2, n, 2):
            if a[i] != a[i-1] or a[i] != t:
                print((0))
                exit()
            t += 2
        print(((2 ** ((len(a) - 1) // 2)) % (10 ** 9 + 7)))
    else:
        t = 1
        for i in range(1, n, 2):
            if a[i] != a[i-1]:
                print((0))
                exit()
            t += 2
        print(((2 ** (len(a) // 2)) % (10 ** 9 + 7)))


if __name__ == '__main__':
    slove()


# Optimized solution
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort()
    t = 0
    if n % 2 == 0:
        t = 1
    for i in range(n):
        if i % 2 == n % 2 and i != 0:
            t += 2
        if a[i] != t:
            print((0))
            exit()
    print(((2 ** (n // 2)) % mod))


if __name__ == '__main__':
    solve()
# Original solution
from collections import Counter
N = int(eval(input()))
AC = Counter(list(map(int, input().split())))
if N % 2 == 1:
    if N == 1:
        ans = AC[0] == 1
    else:
        ans = AC[0] == 1
        for k, v in AC.most_common(N//2):
            if k > N-1 or k % 2 != 0 or v != 2:
                ans = False
                break
else:
    ans = True
    for k, v in AC.most_common():
        if k > N or k % 2 == 0 or v != 2:
            ans = False
            break
if ans:
    print((pow(2, N//2, 10**9+7)))
else:
    print((0))

# Optimized solution
from collections import Counter
N = int(eval(input()))
Alist = list(map(int, input().split()))
Ac = Counter(Alist)
mod = 10**9+7
if N%2==0:
    for i in range(1, N, 2):
        if Ac[i] != 2:
            print((0))
            break
    else:
        print((pow(2, (N//2), mod)))
else:
    if Ac[0] != 1:
        print((0))
    else:
        for i in range(2, N, 2):
            if Ac[i] != 2:
                print((0))
                break
        else:
            print((pow(2, (N//2), mod)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
    if A[0] != 0:
        print((0))
        exit()
    for i in range(N // 2):
        if A[2 * i + 1] != 2 * (i + 1) or A[2 * i + 2] != 2 * (i + 1):
            print((0))
            exit()
    print((pow(2, N // 2) % (10 ** 9 + 7)))
else:
    for i in range(N // 2):
        if A[2 * i] != 2 * i + 1 or A[2 * i + 1] != 2 * i + 1:
            print((0))
            exit()
    print(((pow(2, N // 2)) % (10 ** 9 + 7)))


# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))
a.sort()
if n%2==1:
    if a[0]!=0:
        print((0))
        exit()
    for i in range(n//2):
        if a[2*i+1]!=2*(i+1) or a[2*(i+1)]!=2*(i+1):
            print((0))
            exit()
    print((pow(2,n//2)%(10**9+7)))
else:
    for i in range(n//2):
        if a[2*i]!=2*i+1 or a[2*i+1]!=2*i+1:
            print((0))
            exit()
    print((pow(2,n//2)%(10**9+7)))
# Original solution
#!/usr/bin/env python
# -*- coding:utf-8 -*-

from collections import Counter
import sys
N = int(eval(input()))
A = list(map(int, input().split()))

MOD = 10**9 + 7
A = Counter(A)

if N % 2 == 1:
    for num, cnt in list(A.items()):
        # print(num, cnt)
        if num == 0:
            if cnt != 1:
                print((0))
                sys.exit()
        else:
            if not (num % 2 == 0 and cnt == 2):
                print((0))
                sys.exit()
    print(((2 ** (N // 2)) % MOD))
else:
    for num, cnt in list(A.items()):
        # print(num, cnt)
        if not (num % 2 == 1 and cnt == 2):
            print((0))
            sys.exit()
    print(((2 ** (N // 2)) % MOD))


# Optimized solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
# N = 5
# A = [2, 4, 4, 0, 2]
mod = 10 ** 9 + 7

cnt = Counter(A)
if N % 2 == 0:
    if len(list([c for c in list(cnt.values()) if c != 2])) != 0:
        print((0))
    else:
        print(((2 ** (N // 2)) % mod))
else:
    if cnt[0] != 1:
        print((0))
    else:
        cnt.pop(0)
        if len(list([c for c in list(cnt.values()) if c != 2])) != 0:
            print((0))
        else:
            print(((2 ** (N // 2)) % mod))
# Original solution
n = int(eval(input()))

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

if n % 2 == 0:
    b = 0
    for i in range(n//2):
        if a.count(i*2+1) != 2:
            b = 1
    if b == 1:
        print((0))
    else:
        print((2**(n//2)))
else:
    b = 0
    if a.count(0) != 1:
        b = 1
    else:
        for i in range(n//2):
            if a.count((i+1)*2) != 2:
                b = 1
    if b == 1:
        print((0))
    else:
        print((2**(n//2)))

# Optimized solution
n = int(eval(input()))

a = list(map(int,input().split()))
a.sort()
if n % 2 == 0:
    b = 0
    for i in range(0,n,2):
        if a[i] != a[i+1] and a[i] != i+1:
            b = 1
    if b == 1:
        print((0))
    else:
        print(((2**(n//2))%1000000007))
else:
    b = 0
    if a[0] != 0:
        b = 1
    else:
        for i in range(1,n,2):
            if a[i] != a[i+1] and a[i] != i+1:
                b = 1
    if b == 1:
        print((0))
    else:
        print(((2**(n//2))%1000000007))
# Original solution
#! /usr/bin/env python3

D = 10**9+7
N = int(eval(input()))
A = list(map(int, input().split()))
M = N%2>0
b = 1
if M:
    if A.count(0) != 1 : b = 0
    for i in range(2, N, 2):
        if A.count(i) != 2 : b = 0
else:
    for i in range(1, N, 2):
        if A.count(i) != 2 : b = 0


print(((2**(N//2))%D if b else 0))

# Optimized solution
#! /usr/bin/env python3

D = 10**9+7
N = int(eval(input()))
A = list(map(int, input().split()))
M = N%2>0
b = 1
C = [0] * (N//2+1)
if M:
    for i in A:
        if i%2 < 1:
            C[i//2] += 1 
    b = (N//2) == sum(1 for x in C[1:] if x == 2) and C[0] == 1
    
else:
    for i in A:
        if i%2 > 0:
            C[i//2] += 1 
    b = (N//2) == sum(1 for x in C if x == 2)

print(((2**(N//2))%D if b else 0))
# Original solution
from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

x = N // 2
ans = pow(2, x, mod)

c = Counter(A)
if N & 1:
    for i in range(0, N, 2):
        if i == 0 and c[i] == 1:
            continue
        if c[i] == 2:
            continue
        ans = 0
else:
    for i in range(1, N, 2):
        if c[i] == 2:
            continue
        ans = 0

print(ans)


# Optimized solution
from collections import Counter
mod = 10 ** 9 + 7


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    C = Counter(A)

    # check
    if N % 2 == 1:
        if C[0] != 1:
            return 0
        for i in range(2, N, 2):
            if C[i] != 2:
                return 0
    else:
        for i in range(1, N, 2):
            if C[i] != 2:
                return 0
    return pow(2, N//2, mod)


if __name__ == "__main__":
    print((main()))
# Original solution
from math import floor

a, b, n = list(map(int, input().split()))
# a, b, n = 4628, 3261783, 3421

max_num = -99999999999999999999999

for i in range(n):
    x = i + 1
    num = floor(a*x / b) - a * floor(x / b)
    
    if num > max_num:
        max_num = num
        
print(max_num)

# Optimized solution
from math import floor

a, b, n = list(map(int, input().split()))
        
x = min(n, b-1)
if x < 0:
    x = 0
    
print((floor(a*x / b) - a * floor(x / b)))
# Original solution
A,B,N = list(map(int,input().split()))
tmp=0
for i in range(0,N+1):
    floor = (A*i)//B-A*(i//B)
    if floor>tmp:
        tmp = floor
print(tmp)

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

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

for k in range(0, (N+1)//B + 1):
    
    x = (k+1)*B - 1
    if x > N:
        x = N
    func = floor(A*x/B) - A * floor(x/B)
    f = max(func, f)
    
print(f)



# Optimized solution
from math import floor

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

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

print(ans)
# Original solution
import math
a, b, n = list(map(int,input().split()))
ans = 0
m = math.floor(n/10)
for i in range(m,n+1):
    s = math.floor(a * i / b)
    t = math.floor (i/b)
    ans = max(ans,s - a*t)     
print(ans) 

# Optimized solution
a, b, n = list(map(int,input().split()))
ans = 0
x = min(n , b-1)
print((x*a //b))
# Original solution
a,b,n=list(map(int,input().split()))
ans=0
x=0
y=0
# while(x<=n or y<=n):
#     ans=max(ans,((a*x)//b - a*(x//b)),((a*y)//b - a*(y//b)))
#     x+=b
#     y=-(-x//a)

for i in range(n+1):
    ans=max(ans,((a*i)//b - a*(i//b)))
print(ans)


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

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

print((f(min(b-1,n))))
# Original solution
import math
import sys
A,B,N=list(map(int, input().split()))
NUM=0
if N<B:
    NUM=math.floor(A*N/B)-A*math.floor(N/B)
    print(NUM)
    sys.exit()
else:
    if A>B:
        for x in range(N+1,math.floor(N/4),-1):
            TGT=math.floor(A*x/B)-A*math.floor(x/B)
            if TGT>NUM:
                NUM=TGT
    else:
        for x in range(1,math.floor(N/4)+1):
            TGT=math.floor(A*x/B)-A*math.floor(x/B)
            if TGT>NUM:
                NUM=TGT
print(NUM)

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

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

_max = 0
for x in range(N, int(N/2), -1):
    if x < 1:
        break
    num =math.floor(A * x / B) - A * math.floor(x/B) 
    # print(num)
    if  num > _max:
        _max = num

print(_max)


# Optimized solution
import math

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

A, B, N = list(map(int, input().split(' ')))
x = min(N, B-1)
print((floor(A,B,x)))
# Original solution
A,B,N=list(map(int,input().split()))

maxP=-10**15

if N<100000000:
    for i in range(1,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
        
else:
    for i in range(1,10000000):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
    for i in range(N-10000000,N+1):
        tmp=(A*i)//B-A*(i//B)
        if maxP<tmp:
            maxP=tmp
print(maxP)

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

i=min(B-1,N)


tmp=(A*i)//B-A*(i//B)

        
print(tmp)
# Original solution
a, b, n = list(map(int, input().split()))
ans = 0
for x in range(1, min(b,n) + 1):
    fx = int(a*x/b) - a * int(x/b)
    if ans < fx:
        ans = fx
print(ans)

# Optimized solution
a, b, n = list(map(int, input().split()))
y = 0
if n >= b:
    y = b - 1
else:
    y = n
print((int(a*y/b)))
# Original solution
[A,B,N] = list(map(int,input().split()))

x=N
dammy=[]
while x > N//(1.1):
    dammy.append((A*x)//B - A * int(x/B))
    x = x -1
print((max(dammy)))


# Optimized solution
[A,B,N] = list(map(int,input().split()))

W = N//B
dammy=[]
x=N
dammy.append((A*x)//B - A * int(x/B))
x=(B * W)-1
dammy.append((A*x)//B - A * int(x/B))


print((max(dammy)))
# Original solution
from sys import stdin, stdout
from collections import defaultdict
import math
from queue import Queue

a, b, n = list(map(int, stdin.readline().strip().split()))

x = min(b - 1, n)

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

stdout.writelines(str(ans) + '\n')



# Optimized solution
import math


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


A, B, n = list(map(int, input().split()))
print((eq_value(A, B, min(B-1, n))))
# Original solution
import math
a,b,n = list(map(int,input().split()))
m = 0
x = 1
ax = a*x
while ax/b <0.01:
    x*=10
    ax = a*x
    if x>n:
        x//10
        break
if a-b==1:
    print(n)
elif b-a==1:
    print((n-1))
else:
    for i in range(x,n+1):
        ch = math.floor(a*i/b)-a*math.floor(i/b)
        m = max(m,ch)
        if m!=0 and ch==0:
            break
    print(m)

# Optimized solution
import math
a,b,n = list(map(int,input().split()))
x = min(b-1,n)
print((math.floor(a*x/b)-a*math.floor(x/b)))
# Original solution
A,B,N= list(map(int, input().split()))
ma=0
for i in range(1,min(N,B)+1):
    a=int(A*i/B)-A*int(i/B)
    if(ma<a):
        ma=a
    if(a>=A):
      break
print(ma)

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


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


def main():
    a, b, n = list(map(int, input().split()))
    if n < min(a, b):
        print((f(n, a, b)))
    elif min(a, b) <= n < max(a, b):
        print((max(f(min(a, b) - 1, a, b), f(n, a, b))))
    else:
        print((max(f(max(a, b) - 1, a, b), f(min(a, b) - 1, a, b))))


if __name__ == '__main__':
    main()



# Optimized solution
from math import floor


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


if __name__ == '__main__':
    main()
# Original solution

"""
=int(input())
=map(int,input().split())
=list(map(int,input().split()))

# アレイ import numpy as np =np.array(list(map(float,input().split())))

# 文字列 =list(str(input()).split(" " or ","))

# 一文字＆連番(縦横可能) =map(int, open(0).read().split())

# 2-d list
lis=[[] for _ in range(M)]
for i in range(M):
    lis[i] = list(map(int,input().split()[0:]))

# Each list
N = int(input())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
"""

import math
a,b,n=list(map(int,input().split()))
kai=[]
for i in range(b,n+1,b):
    k=math.floor(a*i/b)-a*math.floor(i/b)
    kai.append(k)
    k=math.floor(a*(i-1)/b)-a*math.floor((i-1)/b)
    kai.append(k)

if len(kai)==0:
    kai.append(math.floor(a*n/b)-a*math.floor(n/b))
print((max(kai)))


# Optimized solution
a, b, n = list(map(int, input().split()))
x = min(b - 1, n) # b-1がいいけど、上限 nの制約あり
ans = int(a * x / b)
print(ans)
# Original solution
a, b, x = list(map(int, input().split()))

o = x
x = max(0, x - 10000000)

m = 0

while x <= o:
    r = max(0, o - x)

    m = max(m, (a*x) // b - a * (x // b))
    m = max(m, (a*r) // b - a * (r // b))
    x += 1

print(m)

# Optimized solution
a, b, x = list(map(int, input().split()))

o = x
x = max(0, x - 2000000)

m = 0

while x <= o:
    r = max(0, o - x)

    m = max(m, (a*x) // b - a * (x // b))
    m = max(m, (a*r) // b - a * (r // b))
    x += 1

print(m)
# Original solution
def floor(x):
    return int(x)

a,b,n=list(map(int,input().split()))
if b<n:
    m=floor((a*(b-1)/b))
    for i in range(b,n+1):
        tmp=floor(a*i/b)-(floor(i/b)*a)
        if tmp>m:
            m=tmp
    print(m)
else:
    m=0
    for i in range(1,n+1):
        tmp=floor(a*i/b)-(floor(i/b)*a)
        if tmp>m:
            m=tmp
    print(m)

# Optimized solution
a,b,n=list(map(int,input().split()))
m=min(n,b-1)
tmp=(a*m//b)-((m//b)*a)    
print(tmp)
# Original solution
a,b,n=list(map(int,input().split()))
ans=0
for i in range(n+1):
    ans=max(ans,int((a*i)/b)-a*int(i/b))
print(ans)

# Optimized solution
a,b,n=list(map(int,input().split()))
k=min(n,b-1)
print((int((a*k)/b)-a*int(k/b)))
# Original solution
a, b, n = list(map(int, input().split()))

ans = 0
if b > n:
    x = n
    ans = int(a * x // b) - int(a * (x // b))
else:
    m = 0
    for i in range(b):
        if int(a * (n - i) // b) - int(a * ((n - i) // b)) > m:
            m = int(a * (n - i) // b) - int(a * ((n - i) // b))
    ans = m
print(ans)


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

ans = 0
if b > n:
    x = n
    ans = int(a * x // b) - int(a * (x // b))
else:
    x = n
    ans1 = int(a * x // b) - int(a * (x // b))
    x = (n//b)*b-1
    ans2 = int(a * x // b) - int(a * (x // b))
    ans = max(ans1,ans2)
print(ans)
# Original solution
a, b, n = list(map(int, input().split()))
ans = 0
for i in range(n + 1):
    floor = int(a * i / b) - a * int(i / b)
    ans = max(ans,floor)
print(ans)

# Optimized solution
a, b, n = list(map(int, input().split()))
x = min(n, b - 1)
ans = int(a * x / b) - a * int(x / b)
print(ans)
# Original solution
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B,N = LMIIS()

    ans = 0
    for i in range(max(0,N-10**7),N+1):
        ans = max(floor(A*i/B)-A*floor(i/B),ans)
    for i in range(1,min(N+1,N-10**7)):
        ans = max(floor(A*i/B)-A*floor(i/B),ans)
    
    
    print(ans)


    

if __name__ == '__main__':
    main()


# Optimized solution
import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B,N = LMIIS()

    ans = 0
    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))
    
    # for i in range(1,int(N**0.5)+1):
    #     ans = max(ans,floor(A*i/B)-A*floor(i/B))
    #     i2 = N//i
    #     ans = max(ans,floor(A*i2/B)-A*floor(i2/B))
    #     # print(i,i2)
    # print(ans)

    # ans2 = 0
    # for i in range(1,N+1):
    #     ans2 = max(ans2,floor(A*i/B)-A*floor(i/B))
    # print(ans2)
    

if __name__ == '__main__':
    main()
# Original solution

from sys import stdin
input = stdin.readline

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

if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)

else:
    for i in reversed(list(range(n+1))):
        tmp = int((a * i) / b)  - a * int(i/b) 
        if b > 1:
            if i % (b-1) == 0 :
                maxpoint = max(tmp,maxpoint)
                print(maxpoint) 
                exit()
        elif b == 1:
            print((0))
            exit()
        maxpoint = max(tmp,maxpoint)

print(maxpoint)


# Optimized solution
from sys import stdin
input = stdin.readline
 
a,b,n = list(map(int,input().split()))
maxpoint = 0
 
if b > n  :
    tmp = int((a * n) / b)  - a * int(n/b) 
    maxpoint = max(tmp,maxpoint)
else:
    k = int(n/b)*b -1
    maxpoint =  int((a * k) / b)  - a * int(k/b) 
    if b == 1:
        maxpoint = 0
 
print(maxpoint)
# Original solution
import math
a, b, n = list(map(int, input().split()))
ma = -1
for x in range(n, -1, -1):
    tmp = math.floor(a*x/b) - a*math.floor(x/b)
    if ma < tmp:
        ma = tmp
print(ma)

# Optimized solution
import math
a, b, n = list(map(int, input().split()))
def f(x):
    return math.floor(a*x/b) - a*math.floor(x/b)
print((f(min(b-1, n))))
# Original solution

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

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


# Optimized solution

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

if N >= B:
    print((A * (B - 1) // B))
else:
    print((A * N // B))
# Original solution
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):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    
    ans = max(ans, val)

print(ans)


# Optimized solution
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    #print("i", i, "val", val)
    ans = max(ans, val)

print(ans)