def f(): a,b,c = map(int,input().split()) if a > c: return c d = a + b - 1 return c//d*a + (c%d if c%d < a else a) print(f())