import java.util.Arrays; import java.util.Scanner; public class no176 { void run() { Scanner sc = new Scanner(System.in); long A, B, T; A = sc.nextInt(); B = sc.nextInt(); T = sc.nextInt(); long ans = Long.MAX_VALUE; for (long i = 0; A*i <= T+A && i <= A; i++) { ans = Math.min(ans, A*i + (T-A*i+B-1)/B * B); } System.out.println(ans); } void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } public static void main(String[] args) { new no176().run(); } }