#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int m, n, p, s = 0;
    cin >> m >> n >> p;
    p--;
    short a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            a[i][j] = 0;
        }
    }
    vector<pair<int, int>> pos{{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
    a[0][0] = m;
    int i = 0, j = 0, k = 0;
    for (int l = 1; l < n*n; l++) {
        if (i + pos[k].first >= n || j + pos[k].second >= n || a[i + pos[k].first][j + pos[k].second] != 0) {
            k++;
            k%=4;
        }
        m++;
        i+=pos[k].first;
        j+=pos[k].second;
        a[i][j] = m;
    }
    for (int l = 0; l < n; l++) {
        s+=a[p][l];
    }
    cout << s;
    return 0;
}
