#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("bai2_16.inp", "r", stdin);
	freopen("bai2_16.out", "w", stdout);
 	int a,b,c;
 	int e;
 	cin>>a>>b>>c;
 	if(a<b)
 	{
 		int t=c/a;
 		int d=c%a;
 		int k=d/(b-a);
 		e=k*b+(t-k)*a;
 		cout<<e;
	}
	if(a>b)
	{
		int t=c/b;
		int d=c%b;
		int k=d/(a-b);
		e=k*a+(t-k)*b;
		cout<<e;
	}
	if(a==b)
	{
		int t=c/a;
		int d=c%a;
		e=c-d;
		cout<<e;
	}
}

