#include<bits/stdc++.h>
#define LL long long
using namespace std;
LL Pow(LL x,LL y,int mod)
{
	if(y==0) return 1ll;
	if(y==1) return x;
	LL a=Pow(x,y>>1,mod);
	if(y&1) return (((a*a)%mod)*x)%mod;
	return (a*a)%mod;
}
int main()
{
	LL a,b,c;
	cin>>a>>b>>c;
	LL x=Pow(b%4,c,4)+4;
	cout<<Pow(a%10,x,10);
	 
}

#include <bits/stdc++.h>
#include <cmath>

using ll = long long;
const ll INF = __LONG_LONG_MAX__;

using namespace std;



int main() {
    long double x, y, r;
    cin >> x >> y >> r;

    long double e = 1e-9;
    //cout << e << endl;

    ll ans = 0ll;
    for(ll i = (ll)(floor(y+r)); i >= (ll)(ceil(y-r)); i--) {
        long double val = sqrt(r * r - (i-y)*(i-y) + e);
        ll l = ceil(x - val);
        ll r = floor(x + val);
        /*cout << i << " " << val << endl;
        cout << l << " " << r << endl;*/
        ans += r - l + 1;
    }

    cout << ans << endl;

    return 0;
}