import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;
import std.numeric;

long mod = 1000000007;

long modinv(long a) {
  long b=mod, u=1, v=0;
  while(b>0) {
    long t=a/b;
    a -= t*b; swap(a,b);
    u -= t*v; swap(u,v);
  }
  u %= mod;
  if(u<0) u+=mod;
  return u;
}

void main() {
  long a, b, n;
  readf("%d %d %d\n", &a, &b, &n);
  long GCD = gcd(a,b);
  long LCM = a*b/GCD;
  long pos = n % LCM;
  writeln(a*pos/b - a*(pos/b));
}
