#include<iostream>
using namespace std;
int main()
{
    long long a, b, L, br = 0, br1 = 0, br2 = 0, m;

    cin >> a >> b >> L;

    br += a + b - 1;

    for(int k = a + b; k <= L; k++)
    {
        for(int x = 1; x < L; x++)
        {
            if((k - (a * x)) % b == 0 && (k - (a * x)) / b > 0)
            {
                br1++;

                //cout << x << ' ' << (k - (a * x)) / b << ' ' << k;

                break;
            }
        }
    }

    br2 = L - (a + b) + 1;

    m = br2 - br1;

    br+=m;

    cout << br;

    return 0;
 }
