#include <bits/stdc++.h>
#define int long long
using namespace std;
struct ret{
int a,b,c;
};
ret mul(int a, int b, int c){
return {a*a+b*b, a*b + b*c, b*b+c*c};
}
ret p1(int a, int b, int c){
return {b, a + b, b + c};
}
ret fibo(int r){
// cout << r << '\n';
if(r == 1){
return {0,1,1};
}
auto [a,b,c] = fibo(r / 2); // f1 f2 f3
if(r % 2 == 0){
return mul(a,b,c);
}
else{
ret f = mul(a,b,c);
return p1(f.a,f.b,f.c);
}
}
int ans = 0;
map<int, int>mp;
signed main(){
int n;
int r, u;
cin >> r >> u >> n;
if(n >= 100){
cout << r * u << '\n';
return 0;
}
auto [a,b,c] = fibo(n - 1);
// cout << a << ' ' << b << ' ' << c << '\n';
for(int i = 1; i <= r; i++){
for(int j = 1; j <= u; j++){
if(mp[a * i + b * j] == 0){
ans++;
mp[a * i + b * j]++;
}
}
}
cout << ans << '\n';
}