#include<bits/stdc++.h>
int n, m, x, y;
int k;
int check(int a, int b, int x, int y, int k) {
    if (x == a && y == b)
        return 0;
    int ans = a == x || b == y;
    return ans && std::abs(a-x) + std::abs(b - y) < k && (a == x ? b + k < m : a + k < n);
}


int go(int **a, int x, int y) {
    int ans = 0, cnt = 0;
    int havel = 0, haver = 0, haveu = 0, haved = 0; 
    if (x > 0 && n >= k) {
        int u = 1;
        while (x - u >= 0 && a[x - u][y] == 1)
            ans++, cnt++, u++;
        if (x - u >= 0)
            ans++;        
        haveu = cnt > 0;
    }
    if (cnt == k - 1)
        return ans;
    if (y < m - 1 && !haveu && m >= k) {
        int r = 1;
        while (y + r <= m - 1 && a[x][y + r] == 1)
            ++ans, ++cnt, ++r;
        if (y + r <= m - 1)
            ++ans;
        haver = r > 1;
    }    
    if (cnt == k - 1)
        return ans;
    if (!haver && x < n - 1 && n >= k) {
        int d = 1;
        while (x + d <= n - 1 && a[x + d][y] == 1)
            ans++, cnt++, d++;
        if (x + d <= n - 1)
            ans++;        
        haved = d > 1;
    }
    if (cnt == k - 1)
        return ans;
    if (y > 0 && !haved && !haveu && m >= k) {
        int l = 1;
        while (y - l >= 0 && a[x][y - l] == 1)
            ++ans, ++cnt, ++l;
        if (y - l >= 0)
            ++ans;
        havel = l > 1;
    }   
    assert(cnt == k - 1);
    return ans;
}

int main() {
    freopen("seabattle.in", "r", stdin);
    freopen("seabattle.out", "w", stdout);
    scanf("%d%d", &n, &m);
    scanf("%d%d", &x, &y);
    scanf("%d", &k);
    x--, y--;
    int **a = new int*[20];
    for (int i = 0; i < 20; ++i)
        a[i] = new int[20];
    int ans = 0;
    std::cerr << x << " " << y << "\n";
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (!check(i, j, x, y, k))
                continue;
            memset(a, 0, n * m * 4);
            std::cerr << i << " " << j << "\n";
            if (i == x) {
                for (int t = j; t - j + 1 <= k; ++t)
                    a[i][t] = 1;
            } else {
                 for (int t = i; t - i + 1 <= k; ++t)
                    a[t][i] = 1;           
            }
            ans = std::max(ans, go(a, x, y));
        }

    }
    printf("%d", ans);
    return 0;
}
