// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int ll
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define vi vector<int>
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a, ll mod){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n,ll mod){
    return fastexp(n,mod-2,mod);
}
template <typename T>
void add(T &a, T b, T mod){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b, T mod){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b, T mod){
	a *= b;
	if(a >= mod)a %= mod;
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	int ans = 1;
	// mod = 4;
	int z = fastexp(b,c,4ll);
	// cout<<z<<"\n";
	// mod = 10;
	if(a%2 == 0){
		int d = 0;
		while(a%2 == 0){
			a /= 2;
			d++;
		}
		mul(d,z,4ll);
		if(d%4 == 0){
			ans = 6;
		}
		else if(d%4 == 1){
			ans = 2;
		}
		else if(d % 4 == 2){
			ans = 4;
		}
		else if(d%4 == 3){
			ans = 8;
		}
	}
	if(a % 5 == 0){
		while(a % 5 == 0){
			a /= 5;
		}
		mul(ans,5ll,10ll);
	}
	for(int i = 3;i*i <= a;i += 2){
		if(a%i == 0){
			int d = 0;
			while(a%i == 0){
				d++;
				a /= i;
			}
			// cout<<i<<" "<<d<<"\n";
			mul(d,z,4ll);
			// cout<<d<<"\n";
			int temp = fastexp(i,d,10ll);
			// cout<<temp<<
			mul(ans,temp,10ll);
			// cout<<ans<<"\n";
		}
	}
	if(a > 1){
		// cout<<a<<"\n";
		int d = 1;
		// while(a%i == 0){
		// 	d++;
		// 	a /= i;
		// }
		mul(d,z,4ll);
		mul(ans,fastexp(a,d,10ll),10ll);
	}
	cout<<ans;
	// int z = fastexp(b,c);
	// mod = 10;
	// cout<<fastexp(a,z);
	return 0;
}
#include <cstdio>
#define DIV 10000LL
using namespace std;

typedef long long LL;

LL x, y, R;

inline LL read()
{
	// Returns: input * 10000.
	LL res = 0LL;
	int num = 0;
	bool flag = false, negative = false;
	for(char c=getchar(); c != ' ' && c != '\n'; c=getchar())
	{
		if(c == '-') negative = true;
		else if(c == '.') flag = true;
		else
		{
			res *= 10LL;
			res += c - '0';
			if(flag) num ++;
		}
	}
	for(int i=num; i<4; i++)
		res *= 10LL;
	return negative? -res: res;
}

inline LL in_circle(const LL& dx, const LL& dy)
{
	return dx * dx + dy * dy <= R * R;
}

inline LL findtop(LL i)
{
	i *= DIV;
	LL l = y, r = y + R;
	while(l < r)
	{
		LL mid = l + r + 1LL >> 1LL; // l<0?
		if(in_circle(i - x, mid - y))
			l = mid;
		else r = mid - 1LL;
	}
	return l;
}

inline LL ceildiv(const LL& a)
{
	// Returns: ceil(a / DIV).
	if(a < 0LL) return a / DIV;
	if(a % DIV == 0LL) return a / DIV;
	return a / DIV + 1LL;
}

inline LL floordiv(const LL& a)
{
	// Returns: floor(a / DIV).
	if(a >= 0LL) return a / DIV;
	if(a % DIV == 0LL) return a / DIV;
	return a / DIV - 1LL;
}

int main()
{
	x = read(), y = read(), R = read();
	LL ans = 0LL, left = ceildiv(x - R), right = floordiv(x + R);
	for(LL i=left; i<=right; i++)
	{
		LL top = findtop(i);
		LL bottom = (y << 1LL) - top;
		ans += floordiv(top) - ceildiv(bottom) + 1LL;
	}
	printf("%lld\n", ans);
	return 0;
}