   program abc165d
      implicit none
      integer(8)::a,b,n,m,i,ans=0

         read *, a,b,n

         m=0
         do while (m*b-1<=n)
            if (ans<f(m*b-1)) ans=f(m*b-1)
            m=m+1
         end do

         if (ans<f(n)) ans=f(n)

         print *, ans
         stop

   contains
      function f(x)
         implicit none
         integer(8),intent(in)::x
         integer(8)::f,s,t

            if (x<0) then
               f=-1
               return
            end if
            s=a*x/b
            t=x/b
            f=s-a*t
            return
      end function

   end program abc165d