#include<bits/stdc++.h>

using namespace std;
int ucln(int a,int b)
{
	while (b!=0)
	{
		int r=a%b;
		a=b;
		b=r;
	}
	return a;
}
int bcnn(int a,int b)
{
	return a*b/ucln(a,b);
}
int main()
{
	int m,n,k;
	ifstream f1("BAI2_17.INP");
	ofstream f2("BAI2_17.OUT");
	f1>>m>>k>>n;
	f2<<n/m+n/k-n/bcnn(m,k);
}
