#include<iostream>
using namespace std;
int p[][4]={{0,0,0,0},{1,1,1,1},{6,2,4,8},{1,3,9,7},{6,4,6,4},{5,5,5,5},{6,6,6,6},{1,7,9,3},{6,8,4,2},{1,9,1,9}};

int f(int b,int c)//快速幂
{
    int ans=1;
    while(c)
    {
        if(c%2==1)
        {
            ans*=b%4;
            c--;
        }
        b=b*b%4;
        c/=2;
    }
    return ans;

}

int main()
{
    int a,b,c;
    int temp;
    cin>>a>>b>>c;
    a%=10;
    temp=f(b,c);
    cout<<p[a][temp]<<endl;
    return 0;
}

/**
*
* @Author : Sindys
* Language  : C++
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue> 
#include <iomanip>
#include <map>
#include <set>
#include <limits>//numeric_limits<int>::max() ... numeric_limits<int>::min()
#include <cmath>
#include <bitset>
#include <tuple>
#include <deque>
#include <stack>

using namespace std;
#define ll                  long long
#define pii                 pair<int, int>    
#define vpii                vector<pii>       
#define vi                  vector<int>      
#define vd                  vector<double>     
#define vll                 vector<ll>       
#define INF                 1000000000
#define pb                  push_back
#define FOR(i,a,b,p)          for (int i = a; i < b; i += p)
#define ROF(i,b,a,p)          for (int i = b-1; i >= a; i -= p)
#define mp                  make_pair
#define f                   first
#define s                   second
#define FORX(a,b,n)         for (; a < b; a += n)//for every +n operation
#define ROFX(a,b,n)         for (; a > b; a -= n)//for every -n operation
const int M = 1000000007;

//memset(memo, -1, sizeof memo); // initialize DP memoization table with -1
//memset(arr, 0, sizeof arr); // to clear array of integers
// index = (index + 1) % n; // index++; if (index >= n) index = 0;
// index = (index + n - 1) % n; // index--; if (index < 0) index = n - 1;
// int ans = (int)((double)d + 0.5); // for rounding to nearest integer


void solve() {
    long double x, y, r;
    cin>>x>>y>>r;
    ll res = 0;
    ll highestPointY = floor( y + r );
    ll lowestPointY = ceil( y - r);
    r = nextafter(r, INFINITY);
    for(ll i = highestPointY; i >= lowestPointY; i--) {
        long double width = sqrt( r * r - abs(i - y) * abs(i - y));
        res += floor(x + width) - ceil(x - width) + 1;
    }
    cout<<res<<'\n';
     
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}
/*stuff you should look for:
-->overflow,array bounds
-->special cases n=1..
-->use printf for precision or setprecision on cout*/