#include<iostream>
using namespace std;

int main () {
    ios_base::sync_with_stdio(false);
    int a, b, l;
    cin >> a >> b >> l;

    if (a > b) {
        int t = a;
        a = b;
        b = t;
    }


    int ans = 0;
    for (int i = 1; i < l; i++) {
        if (i < a + b) {
            ans++;
            continue;
        }
        int c = i / b;
        bool inc = 1;
        for (int q = 0; q <= a; q++) {
            if ((i - (c * b)) % a == 0) {
                inc = false;
                break;
            }
            c--;
        }
        ans += inc;
    }
    cout << ans;
}
