#include using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll a, ll b){return a * b / gcd(a, b);} int main(){ ll a,b,k; cin>>a>>b>>k; ll n=lcm(a,b); map x; ll num=n/a+n/b-1; ll amari=k%num; ll bai=k/num; for(int i=1;i<=amari;i++){ x[a*i]++; x[b*i]++; } x[n]++; //cout<