print((function (f) local a,b,c = f(),f(),f() if a>c then return c end local d = a+b-1 return tostring(c/d*a+(c%d