#include <bits/stdc++.h>
using namespace std;
ifstream f1("bai2_17.INP");
    ofstream f2("bai2_17.OUT");
    int ucln(int a,int b)
{ while (a!=b)
{if (a>b) a=a-b;
else b=b-a;
}
return a;
}
   long long bcnn(int a, int b)
   { return (a*b)/ucln(a,b);
   }
int main()
{
    int n,k,i,j,d=0,m;
    f1>>k>>m>>n;
    f2<<n/k+n/m-n/bcnn(k,m);
   
}
