#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("bai2_17.inp","r",stdin);
    freopen("bai2_17.out","w",stdout);
    int64_t k,m,n;
    cin>>k>>m>>n;
    int64_t r=n/m +n/k -n/(k*m);
    cout<<r;
}
