import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int t = sc.nextInt(); if (t % a == 0 || t % b == 0) { System.out.println(t); return; } int count = 0; int min = Integer.MAX_VALUE; while (count * b < t) { min = Math.min(min, (t - count * b + a - 1) / a * a + count * b); if (min == t) { System.out.println(t); return; } count++; } min = Math.min(min, (t + b - 1) / b * b); System.out.println(min); } }