#include <algorithm>
#include <iostream>
#include <vector>

#define let auto
#define fn auto
#define usize size_t
using namespace std;

fn fastio() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

fn main() -> int {
    fastio();
    usize r, u, n;
    cin >> r >> u >> n;

    usize cnt = r * u;
    if (n <= 10) {
        usize fibn = 2;
        usize fibns1 = 1;
        usize fibns2 = 1;

        for (usize i = 3; i < n; i++) {
            fibns2 = fibns1;
            fibns1 = fibn;
            fibn = fibns2 + fibns1;
        }
        usize delta = ((u - 1) * fibns1 + (r - 1) * fibns2);
        cout << delta / fibns1 + delta / fibns2 - (delta / (fibns1 * fibns2)) + 1 << endl;
    } else {
        cout << cnt << endl;
    }
}