#include<stdio.h>
#define ll long long
ll llgcd(ll a, ll b){return b == 0 ? a : llgcd(b, a % b);}
ll lllcm(ll a, ll b){return a / llgcd(a, b) * b;}
int main(){
    long long a, b, n, ans = 0;
    scanf("%lld%lld%lld",&a,&b,&n);
    if(b > n){
        ll q = a / b;
        ll p = a % b;
        if(a > b)
            ans = n * q + (p * n) / b;
        else if(a == b){
            ans = n;
        }
        else{
            ll g = llgcd(a, n);
            a /= g;
            n /= g;
            ans = a * n / b * g;
        }
    }
    else if(a < b){
        ans = a;
    }
    else{
        ans = a - (a + b - 1) / b;
    }
    printf("%lld\n",ans);
    return 0;
}