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 in C# (Mono-mcs 6.8.0.105) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace ABC165
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_D();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            //飛距離をKの倍数にすること
            var k = Ex.ReadInt;
            var l = Ex.ReadIntArray();
            //飛距離の範囲はA以上B以下
            var a = l[0];
            var b = l[1];
            bool ans = false;

            for (int i = a; i <= b; i++)
            {
                if (i % k == 0)
                {
                    ans = true;
                    break;
                }
            }

            var str = ans ? "OK" : "NG";
            str.Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
            var x = Ex.ReadLong;
            long ans = 0;
            long i = 100;


            while (i < x)
            {
                i += (long)Math.Floor(i * .01);
                ans++;
            }



            ans.Cw();
        }
    }
    public class ABC_C
    {
        //A は、長さ N の正整数列である。
        int n;
        //1 ≤ A 1 ≤ A 2 ≤ ⋯ ≤ A N ≤ M
        int m;
        long q;
        public ABC_C()
        {
            //正整数 N , M , Q と、 4 つの整数の組 ( a i , b i , c i , d i ) Q 組
            var l = Ex.ReadLongArray();
            n = (int)l[0];
            m = (int)l[1];
            q = l[2];

            //A b i − A a i = c i を満たすような i についての、 d i の総和 (そのような i が存在しないときは 0 )
            //A の得点の最大値を求めてください。
            long ans = 0;

            List<long[]> arr = new List<long[]>();

            for (int i = 0; i < q; i++)
            {
                var lf = Ex.ReadLongArray();
                arr.Add(lf);
            }


            for (int div = 0; div < (1 << (m)); div++)
            {
                int g = 0;
                int[] id = new int[n];
                for (int i = 0; i <= m; i++)
                {
                    if ((div >> i & 1) == 1)
                    {
                        id[g++] = i + 1;
                        if (g == n) break;
                    }
                }

                if (g != n) continue;

                //$"======= {g} {n} {id[0]} {id[1]} {id[2]}".Cw();

                long tmp = 0;
                foreach (var v in arr)
                {
                    var a = v[0] - 1;
                    var b = v[1] - 1;
                    var c = v[2];
                    var d = v[3];
                    //$"======= {a} {b} {c} {d} ".Cw();

                    if (id[b] - id[a] == c) tmp += d;
                }

                ans = Math.Max(ans, tmp);
            }

            ans.Cw();
        }

        long MO()
        {
            long ans = 0;
            long[,] aaa = new long[11, 11];
            bool[,] bbb = new bool[11, 11];
            List<long[]> arr = new List<long[]>();

            for (int i = 0; i < q; i++)
            {
                var lf = Ex.ReadLongArray();
                arr.Add(lf);
                var a = lf[0];
                var b = lf[1];
                var c = lf[2];

                if (bbb[b, a] && aaa[b, a] != c)
                {
                    return 0;
                }
                aaa[b, a] = c;
                bbb[b, a] = true;
            }

            return ans;
        }
    }
    public class ABC_D
    {
        long a;
        long b;
        long n;
        public ABC_D()
        {
            // N以下の非負整数
            // floor(Ax/B)−A×floor(x/B)
            // floor(t)とは、実数t以下の最大の整数
            var l = Ex.ReadLongArray();
            a = l[0];
            b = l[1];
            n = l[2];

            var num = Math.Max(0, Math.Min(b - 1, n));
            var ans = (long)Math.Floor(num * a / (double)b);
            ans.Cw();
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }

        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static string yesno(this bool b) { return b ? "yes" : "no"; }
        public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        public static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}