package yukicoder; import java.util.*; public class Main { public static void main(String[] args)throws Exception{ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); long a=sc.nextLong(); long b=sc.nextLong(); long n=sc.nextLong(); long min=999999999; for(int i=0;i<=b;i++){ min=Math.min(a*i+((n-a*i+b-1)/b)*b, min); if(a*i>n)break; } System.out.println(min); } }