#include<bits/stdc++.h>
using namespace std;



int main()
{
    short n , p, z = 0;
    int m;
    cin>>m>>n>>p;
    int br = n*n;
    int a[n][n];
    while(br>0)
    {
        for(short j = z; j<n-z; j++)
        {
            a[z][j] = m;
            m++;
            br--;
        }
        for(short i = z+1; i<n-z; i++)
        {
            a[i][n-z-1] = m;
            m++;
            br--;
        }
        for(short j = n-z-2; j>=z; j--)
        {
            a[n-z-1][j] = m;
            m++;
            br--;
        }
        for(short i = n-z-2; i>=z+1; i--)
        {
            a[i][z] = m;
            m++;
            br--;
        }
        z++;
    }
    int sum = 0;
    for(short j = 0; j<n; j++)
    {
        sum+=a[p-1][j];
    }
    cout<<sum;
    return 0;
}
