import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

void main() {
    int H, W, N; readf("%d %d %d\n", &H, &W, &N);
    auto F = new int[][H];
    foreach (ref L; F) {
        L = readln.chomp.split(" ").map!(to!int).array;
    }

    auto S = new int[][](H + 1, W + 1);
    foreach (i; 0 .. H) {
        foreach (j; 0 .. W) {
            S[i + 1][j + 1] = S[i + 1][j] + S[i][j + 1] - S[i][j] + F[i][j];;
        }
    }
    int area(int h0, int w0, int h1, int w1) {
        return S[h1][w1] - S[h1][w0] - S[h0][w1] + S[h0][w0];
    }

    int[int[5]] cache;
    int dfs(int n, int h0, int w0, int h1, int w1) {
        if (n == 1) return area(h0, w0, h1, w1);
        auto key = cast(int[5])[n, h0, w0, h1, w1];
        if (key in cache) return cache[key];
        int ans = 0;
        for (int h = h0 + 1; h < h1; h++) {
            ans = max(ans, min(area(h0, w0, h, w1), dfs(n - 1, h, w0, h1, w1)));
            ans = max(ans, min(area(h, w0, h1, w1), dfs(n - 1, h0, w0, h, w1)));
            if (n == 4) {
                ans = max(ans, min(dfs(n - 2, h0, w0, h, w1), dfs(n - 2, h, w0, h1, w1)));
            }
        }
        for (int w = w0 + 1; w < w1; w++) {
            ans = max(ans, min(area(h0, w0, h1, w), dfs(n - 1, h0, w, h1, w1)));
            ans = max(ans, min(area(h0, w, h1, w1), dfs(n - 1, h0, w0, h1, w)));
            if (n == 4) {
                ans = max(ans, min(dfs(n - 2, h0, w, h1, w1), dfs(n - 2, h0, w0, h1, w)));
            }
        }
        return cache[key] = ans;
    }

    int ans = dfs(N, 0, 0, H, W);
    if (N == 4) {
        for (int i = 1; i < H - 1; i++) {
            if (area(0, 0, i, W) <= ans) continue;
            for (int j = 1; j < W - 1; j++) {
                if (area(0, 0, H, j) <= ans) continue;
                for (int y = i + 1; y < H; y++) {
                    for (int x = j + 1; x < W; x++) {
                        ans = max(ans, min(area(0, 0, i, x), area(0, x, y, W), area(y, j, H, W), area(i, 0, H, j)));
                        ans = max(ans, min(area(0, 0, y, j), area(0, j, i, W), area(i, x, H, W), area(y, 0, H, x)));
                    }
                }
            }
        }
    }

    writeln(ans);
}