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++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
using namespace std;

using ui = unsigned int;
using ll = long long;
using ull = unsigned long long;
using str = string;
using bl = bool;
using ch = char;

template<class T> using v = vector<T>;
template<class T> using uset = unordered_set<T>;
template<class T1, class T2> using umap = unordered_map<T1, T2>;

#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define sz(x) ((int)(x).size())
#define ph push_back
#define pp pop_back
#define mp make_pair
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define fore(i, a) for(auto& i : a)
#define FORE(i, a) for(auto i : a) 

template<class T> void pd(T x)
{
    cout << x << " ";
}
template<class T> void pl(T x)
{
    cout << x << endl;
}

// -----



int main()
// {
//     int n, m, q;
//     cin >> n >> m >> q;
//     v<int> a(q), b(q), c(q), d(q);
//     rep(i, 0, q) cin >> a[i] >> b[i] >> c[i] >> d[i];
    
    
// }
{
    ll a, b, n;
    cin >> a >> b >> n;
    
    ll ans = 0;
    // rep(i, 1, n + 1)
    // {
    //     ll temp = ((a * (ll)i) / b) - a * ((ll)i / b);
    //     ans = max(ans, temp);
    //     pl(temp);
    // }
    // ans = ((a * (n - 1)) / b) - a * ((n - 1) / b);
    ans = ((a * (n)) / b) - a * ((n) / b);
    pl(ans);
}