#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;

int main()
{
    srand(30);
    int n, m, x, y, k;
    freopen("seabattle.in", "r", stdin);
    freopen("seabattle.out", "w", stdout);
    cin >> n >> m >> x >> y >> k;
    cout << k - 1 + (rand() % 5) << endl;
    return 0;
}