import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextInt(); long b = sc.nextInt(); long t = sc.nextInt(); long min = Long.MAX_VALUE; for (int i = 0; i <= a && b * i <= t; i++) { long value = (t - b * i + a - 1) / a * a + b * i; min = Math.min(value, min); } System.out.println(min); } }