On the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.

Seating in the class looks like a rectangle, where n rows with m pupils in each. 

The teacher asks pupils in the following order: at first, she asks all pupils from the first row in the order of their seating, then she continues to ask pupils from the next row. If the teacher asked the last row, then the direction of the poll changes, it means that she asks the previous row. The order of asking the rows looks as follows: the 1-st row, the 2-nd row, ..., the n - 1-st row, the n-th row, the n - 1-st row, ..., the 2-nd row, the 1-st row, the 2-nd row, ...

The order of asking of pupils on the same row is always the same: the 1-st pupil, the 2-nd pupil, ..., the m-th pupil.

During the lesson the teacher managed to ask exactly k questions from pupils in order described above. Sergei seats on the x-th row, on the y-th place in the row. Sergei decided to prove to the teacher that pupils are asked irregularly, help him count three values:  the maximum number of questions a particular pupil is asked,  the minimum number of questions a particular pupil is asked,  how many times the teacher asked Sergei. 

If there is only one row in the class, then the teacher always asks children from this row.


-----Input-----

The first and the only line contains five integers n, m, k, x and y (1 ≤ n, m ≤ 100, 1 ≤ k ≤ 10^18, 1 ≤ x ≤ n, 1 ≤ y ≤ m).


-----Output-----

Print three integers:  the maximum number of questions a particular pupil is asked,  the minimum number of questions a particular pupil is asked,  how many times the teacher asked Sergei. 


-----Examples-----
Input
1 3 8 1 1

Output
3 2 3
Input
4 2 9 4 2

Output
2 1 1
Input
5 5 25 4 3

Output
1 1 1
Input
100 100 1000000000000000000 100 100

Output
101010101010101 50505050505051 50505050505051


-----Note-----

The order of asking pupils in the first test:   the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table;  the pupil from the first row who seats at the third table;  the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table;  the pupil from the first row who seats at the third table;  the pupil from the first row who seats at the first table, it means it is Sergei;  the pupil from the first row who seats at the second table; 

The order of asking pupils in the second test:   the pupil from the first row who seats at the first table;  the pupil from the first row who seats at the second table;  the pupil from the second row who seats at the first table;  the pupil from the second row who seats at the second table;  the pupil from the third row who seats at the first table;  the pupil from the third row who seats at the second table;  the pupil from the fourth row who seats at the first table;  the pupil from the fourth row who seats at the second table, it means it is Sergei;  the pupil from the third row who seats at the first table;

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Sorting

Implementation

Constructive algorithms


Solutions:
(n, m, k, x, y) = map(int, input().split())
if n == 1:
	if k % m == 0:
		ans = k // m
		print(ans, ans, ans)
	else:
		rem = k % m
		ans = k // m
		if y <= rem:
			print(ans + 1, ans, ans + 1)
		else:
			print(ans + 1, ans, ans)
	exit(0)
if k == n * m:
	print('1 1 1')
	exit(0)
if k > n * m:
	f = 1
	l = 1
	o = 1
	k -= n * m
	div = k // ((n - 1) * m)
	k = k % ((n - 1) * m)
	if div & 1:
		f = div // 2 + 2
		l = f - 1
	else:
		f = div // 2 + 1
		l = f
	if n == 2:
		o = 0
	else:
		o = div + 1
	s = o
	if x == 1:
		s = f
	if x == n:
		s = l
	if k > 0 and n != 2:
		o += 1
	if k - (n - 2) * m > 0:
		if div % 2 == 0:
			f += 1
	if div & 1:
		for i in range(1, n):
			for j in range(0, m):
				if k == 0:
					break
				if i == x - 1 and j == y - 1:
					s += 1
				k -= 1
			if k == 0:
				break
	else:
		for i in range(n - 2, -1, -1):
			for j in range(0, m):
				if k == 0:
					break
				if i == x - 1 and j == y - 1:
					s += 1
				k -= 1
			if k == 0:
				break
	print(max(o, f, l), min(f, l), s)
	exit(0)
s = 0
for i in range(0, n):
	for j in range(0, m):
		if k == 0:
			break
		if i == x - 1 and j == y - 1:
			s += 1
		k -= 1
	if k == 0:
		break
if s > 0:
	print(1, 0, 1)
else:
	print(1, 0, 0)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def calpos(x, y):
	if n != 1:
		totalRows = k // m
		cycleLength = 2 * n - 2
		totalCycle = totalRows // cycleLength
		rowsLeft = totalRows % cycleLength
		endy = k % m
		if x == 1:
			if rowsLeft > 0 or endy >= y:
				return totalCycle + 1
			else:
				return totalCycle
		elif x == n:
			if rowsLeft >= n:
				return totalCycle + 1
			elif rowsLeft == n - 1:
				if endy >= y:
					return totalCycle + 1
				else:
					return totalCycle
			else:
				return totalCycle
		else:
			ans = 2 * totalCycle
			if rowsLeft >= x:
				ans += 1
			elif rowsLeft == x - 1:
				if endy >= y:
					ans += 1
			if rowsLeft >= n:
				rowsLeft -= n
				finalcompletedrow = n - rowsLeft
				if finalcompletedrow <= x:
					ans += 1
				elif finalcompletedrow == x + 1:
					if endy >= y:
						ans += 1
			return ans
	else:
		tr = k // m
		ans = tr
		lo = k % m
		if lo >= y:
			return ans + 1
		else:
			return ans
(n, m, k, x, y) = map(int, input().split())
ma = -1
mi = 100000000000000000000000
for i in range(1, n + 1):
	for j in range(1, m + 1):
		ma = max(ma, calpos(i, j))
		mi = min(mi, calpos(i, j))
print(ma, mi, calpos(x, y))


def sv(N, M, K, X, Y):
	X -= 1
	Y -= 1
	if N > 1:
		rounds = K // ((N - 1) * M)
		rem = K % ((N - 1) * M)
		gd = [[0] * M for n in range(N)]
		for m in range(0, M):
			gd[0][m] = (rounds + 1) // 2
			gd[N - 1][m] = rounds // 2
		for n in range(1, N - 1):
			for m in range(0, M):
				gd[n][m] = rounds
		if rounds % 2 == 1:
			for n in range(N - 1, -1, -1):
				if not rem:
					break
				for m in range(0, M):
					if not rem:
						break
					rem -= 1
					gd[n][m] += 1
		else:
			for n in range(0, N):
				if not rem:
					break
				for m in range(0, M):
					if not rem:
						break
					rem -= 1
					gd[n][m] += 1
	else:
		rounds = K // M
		rem = K % M
		gd = [[rounds] * M]
		for m in range(rem):
			gd[0][m] += 1
	a1 = max((max(x) for x in gd))
	a2 = min((min(x) for x in gd))
	a3 = gd[X][Y]
	print(a1, a2, a3)
(N, M, K, X, Y) = list(map(int, input().split()))
sv(N, M, K, X, Y)


from sys import stdin

def get(n, m, k, x, y):
	if x > n or x < 1:
		return -1
	if n == 1:
		return k // m + (k % m >= y)
	kr = (n - 1) * 2 * m
	if x == 1 or x == n:
		res = k // kr
	else:
		res = k // kr * 2
	sot = k % kr
	if sot >= (x - 1) * m + y:
		res += 1
	if sot >= (2 * n - 1 - x) * m + y and x != n:
		res += 1
	return res

def solve():
	(n, m, k, x, y) = map(int, input().split())
	ans = [get(n, m, k, 2, 1), get(n, m, k, 1, 1), get(n, m, k, n - 1, 1), get(n, m, k, n, m), get(n, m, k, 1, 1)]
	ans = list(filter(lambda x: x != -1, ans))
	print(max(ans), min(ans), get(n, m, k, x, y))
for i in range(1):
	solve()


(n, m, k, x, y) = map(int, input().split())
if n > 1:
	t = 2 * (n - 1) * m
	(s, p) = (k // t, k % t)
	f = lambda x, y: s + s * (1 < x < n) + (p >= m * x - m + y) + (p >= (2 * n - x - 1) * m + y) * (x < n)
	print(max(f(1, 1), f(2, 1), f(n - 1, 1)), f(n, m), f(x, y))
else:
	g = lambda y: (k - y + m) // m
	print(g(1), g(m), g(y))


(n, m, k, x, y) = map(int, input().split())
if n == 1:
	p = m
else:
	p = n * m + (n - 2) * m
cp = k // p
k %= p
map = [[cp for i in range(m)] for j in range(n)]
for i in range(1, n - 1):
	for j in range(m):
		map[i][j] = cp * 2
cn = 0
cm = 0
inc = 1
while k > 0:
	if cm >= m:
		cn += inc
		if cn >= n:
			inc = -1
			cn -= 2
		cm = 0
	map[cn][cm] += 1
	cm += 1
	k -= 1
ansmin = (cp + 1) * 4
ansmax = 0
for i in range(n):
	for j in range(m):
		ansmin = min(ansmin, map[i][j])
		ansmax = max(ansmax, map[i][j])
print(ansmax, ansmin, map[x - 1][y - 1])


(n, m, k, x, y) = map(int, input().split())
if k < n * m:
	print('1 0', end=' ')
	if (x - 1) * m + y - 1 >= k:
		print(0)
	else:
		print(1)
else:
	a = 1
	if n != 1:
		k -= n * m
		a += k // (2 * (n - 1) * m) * 2
		k = k % (2 * (n - 1) * m)
		our = [[0] * m for i in range(n)]
		for i in range(m):
			our[0][i] = a // 2 + 1
			our[-1][i] = a // 2 + 1
		for i in range(1, n - 1):
			for j in range(m):
				our[i][j] = a
		curr_i = n - 2
		curr_j = -1
		diff = -1
		while k > 0:
			k -= 1
			curr_j += 1
			if curr_j == m:
				curr_j = 0
				curr_i += diff
				if curr_i == -1:
					curr_i += 2
					diff = 1
				elif curr_i == n:
					curr_i -= 2
					diff = -1
			our[curr_i][curr_j] += 1
		ma = 0
		mi = 10 ** 300
		for elem in our:
			ma = max(ma, max(elem))
			mi = min(mi, min(elem))
		print(ma, mi, our[x - 1][y - 1])
	else:
		a = k // m
		k %= m
		if k == 0:
			print(a, a, a)
		else:
			print(a + 1, a, a + (1 if y <= k else 0))


def Count(r, c):
	global n, m, k
	a = k
	if n == 1:
		return a // m + (a % m >= c)
	else:
		cnt = a // ((2 * n - 2) * m)
		if r != 1 and r != n:
			cnt *= 2
		a %= (2 * n - 2) * m
		if a > n * m:
			return cnt + 1 + (1 if r != n and a - n * m >= (n - r - 1) * m + c else 0)
		else:
			return cnt + (1 if a >= (r - 1) * m + c else 0)
(n, m, k, x, y) = map(int, input().split())
print('%d %d %d' % (max(Count(1, 1), Count(2, 1), Count(n - 1, 1)), Count(n, m), Count(x, y)))


(n, m, k, x, y) = map(int, input().split())
arr = [[0 for i in range(m)] for j in range(n)]
if n == 1:
	loop = k // m
	for i in range(m):
		arr[0][i] += loop
	rest = k % m
	i = 0
	j = 0
	while rest > 0:
		arr[i][j] += 1
		j += 1
		if j == m:
			i += 1
			j = 0
		rest -= 1
	print(max(arr[0]), min(arr[0]), arr[x - 1][y - 1])
	return
loop = k // ((n * 2 - 2) * m)
for i in range(m):
	arr[0][i] += loop
	for j in range(1, n - 1):
		arr[j][i] += loop * 2
	arr[n - 1][i] += loop
rest = k % ((n * 2 - 2) * m)
i = 0
j = 0
while rest > 0:
	arr[i][j] += 1
	rest -= 1
	j += 1
	if j == m:
		j = 0
		i += 1
		if i == n:
			break
i = n - 2
j = 0
while rest > 0:
	arr[i][j] += 1
	rest -= 1
	j += 1
	if j == m:
		j = 0
		i -= 1
mx = 0
mn = 100000000000000000000000
for i in range(n):
	mx = max(mx, max(arr[i]))
	mn = min(mn, min(arr[i]))
print(mx, mn, arr[x - 1][y - 1])


(n, m, k, x, y) = map(int, input().split())
if n != 1:
	full_rounds = k // (2 * (n - 2) * m + 2 * m)
	k %= 2 * (n - 2) * m + 2 * m
	A = [[0 for j in range(m)] for i in range(n)]
	row = 0
	col = 0
	while k != 0 and row < n and (col < m):
		A[row][col] += 1
		k -= 1
		col += 1
		if col == m:
			row += 1
			col = 0
	row = n - 2
	col = 0
	while k != 0:
		A[row][col] += 1
		k -= 1
		col += 1
		if col == m:
			row -= 1
			col = 0
	small = 10 ** 18
	big = 0
	if x == n or x == 1:
		serg = full_rounds + A[x - 1][y - 1]
	else:
		serg = 2 * full_rounds + A[x - 1][y - 1]
	for row in A[1:-1]:
		small = min([small] + [2 * full_rounds + a for a in row])
		big = max([big] + [2 * full_rounds + a for a in row])
	small = min([small] + [full_rounds + a for a in A[0]])
	big = max([big] + [full_rounds + a for a in A[0]])
	small = min([small] + [full_rounds + a for a in A[-1]])
	big = max([big] + [full_rounds + a for a in A[-1]])
	print(str(big) + ' ' + str(small) + ' ' + str(serg))
else:
	A = [k // m] * m
	k %= m
	i = 0
	while k != 0:
		A[i] += 1
		k -= 1
		i += 1
	small = 10 ** 18
	big = 0
	serg = A[y - 1]
	small = min([small] + A)
	big = max([big] + A)
	print(str(big) + ' ' + str(small) + ' ' + str(serg))


(n, m, k, x, y) = map(int, input().split())
t = n * m + (n - 2) * m if n != 1 else m
b = k // t
g = []
g.append([b for _ in range(m)])
for _ in range(n - 2):
	g.append([2 * b for _ in range(m)])
g.append([b for _ in range(m)])
r = k % t
mx = -1
mn = int(1e+18)
for i in range(n):
	for j in range(m):
		if r > 0:
			r -= 1
			g[i][j] += 1
		mx = max(mx, g[i][j])
		mn = min(mn, g[i][j])
for i in range(n - 2, 0, -1):
	for j in range(m):
		if r > 0:
			r -= 1
			g[i][j] += 1
		mx = max(mx, g[i][j])
		mn = min(mn, g[i][j])
print(mx, mn, g[x - 1][y - 1])


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 998244353
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	(n, m, k, x, y) = mi()
	x -= 1
	y -= 1
	a = [[0 for i in range(m)] for j in range(n)]
	x1 = 0
	for i in range(n):
		for j in range(m):
			if x1 < k:
				a[i][j] += 1
				x1 += 1
	for i in range(n - 2, 0, -1):
		for j in range(m):
			if x1 < k:
				a[i][j] += 1
				x1 += 1
	for i in range(n):
		for j in range(m):
			a[i][j] *= k // x1
	k %= x1
	x1 = 0
	for i in range(n):
		for j in range(m):
			if x1 < k:
				a[i][j] += 1
				x1 += 1
	for i in range(n - 2, -1, -1):
		for j in range(m):
			if x1 < k:
				a[i][j] += 1
				x1 += 1
	(mx, mnx) = (0, inf)
	for i in range(n):
		for j in range(m):
			mnx = min(mnx, a[i][j])
			mx = max(mx, a[i][j])
	print(mx, mnx, a[x][y])
if file:
	if path.exists('input1.txt'):
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


(n, m, k, x, y) = map(int, input().split())
x -= 1
y -= 1
if n == 1:
	print((k + m - 1) // m, k // m, k // m + (k % m > y))
else:
	cnt = m * (n + n - 2)
	k -= 1
	c = [[k // cnt * (1 + (0 < i < n - 1)) + (k % cnt >= i * m + j) + (0 < i < n - 1) * (k % cnt >= n * m + (n - i - 2) * m + j) for j in range(m)] for i in range(n)]
	print(max([max(c[i]) for i in range(n)]), min([min(c[i]) for i in range(n)]), c[x][y])


import math
from bisect import bisect_right, bisect_left
from collections import Counter, defaultdict
from heapq import heappop, heappush
from itertools import accumulate
R = lambda : map(int, input().split())
(n, m, k, x, y) = R()
group = 0
if n <= 2:
	group = m * n
else:
	group = 2 * (n - 1) * m
(bs, res) = (k // group, k % group)
(mi, mx, boy) = (bs, bs, bs)
if n <= 2:
	mi = bs
	mx = bs + 1 if res > 0 else bs
	boy = bs + 1 if res >= m * (x - 1) + y else bs
else:
	(mi, mx) = (bs, bs * 2)
	if res >= m * n:
		mi = mi + 1
	if res > m * n:
		mx += 2
	elif res > m:
		mx += 1
	elif not mi and (not mx) and res:
		mx += 1
	if 1 < x < n:
		boy = bs * 2
	if res >= m * (x - 1) + y:
		boy += 1
	if 1 < x < n and res >= group - (m - y + (x - 1) * m) + m:
		boy += 1
print(mx, mi, boy)


(n, m, k, x, y) = map(int, input().split())
c = [[0 for _ in range(m)] for _ in range(n)]
if n == 1 or n == 2:
	full = m * n
else:
	full = m * (2 * n - 2)
calls = k // full
k -= calls * full
for i in range(n):
	for j in range(m):
		if i == 0 or i == n - 1:
			c[i][j] = calls
		else:
			c[i][j] = 2 * calls
(cx, cy) = (0, 0)
dx = 1
for i in range(k):
	c[cx][cy] += 1
	if cy + 1 == m:
		if cx == n - 1:
			dx = -1
		cx += dx
	cy = (cy + 1) % m
print(max(max(c)), min(min(c)), c[x - 1][y - 1])


(n, m, k, x, y) = list(map(int, input().split()))
ans = [[0] * m for x in range(n)]
onebig = (2 * n - 2) * m or m
oo = k // onebig
for i in range(n):
	for j in range(m):
		if i == 0 or i == n - 1:
			ans[i][j] += oo
			k -= oo
		else:
			ans[i][j] += 2 * oo
			k -= 2 * oo
from itertools import chain
for i in chain(list(range(n)), list(range(n - 2, 0, -1))):
	if not k:
		break
	for j in range(m):
		if not k:
			break
		ans[i][j] += 1
		k -= 1
_max = max(list(map(max, ans)))
_min = min(list(map(min, ans)))
_ans = ans[x - 1][y - 1]
print(_max, _min, _ans)


(n, m, k, x, y) = list(map(int, input().split()))
t = m if n == 1 else n * m + (n - 2) * m
a = k // t
f = [[0] * 101 for _ in range(101)]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		f[i][j] = a
		if i > 1 and i < n:
			f[i][j] += a
b = k % t
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if b == 0:
			break
		f[i][j] += 1
		b -= 1
	if b == 0:
		break
for i in range(n - 1, 1, -1):
	for j in range(1, m + 1):
		if b == 0:
			break
		f[i][j] += 1
		b -= 1
	if b == 0:
		break
maxnum = max(f[1][1], f[2][1], f[n - 1][1])
minnum = f[n][m]
sergei = f[x][y]
print(maxnum, minnum, sergei)


(R, C, k, x, y) = map(int, input().split())
grid = [[0 for _ in range(C)] for _ in range(R)]
total_in_sweep = R * C + max(R - 2, 0) * C
alloc = k // total_in_sweep
for r in range(R):
	for c in range(C):
		grid[r][c] = alloc * (1 if r == 0 or r == R - 1 else 2)
k -= alloc * total_in_sweep
r = 0
c = 0
for r in range(R):
	if k <= 0:
		break
	for c in range(C):
		if k <= 0:
			break
		k -= 1
		grid[r][c] += 1
for r in range(R - 2, -1, -1):
	if k <= 0:
		break
	for c in range(C):
		if k <= 0:
			break
		k -= 1
		grid[r][c] += 1
a = max(map(max, grid))
b = min(map(min, grid))
c = grid[x - 1][y - 1]
print('%d %d %d' % (a, b, c))


import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65

def getInt():
	return int(sys.stdin.readline().rstrip())

def getInts():
	return map(int, sys.stdin.readline().rstrip().split(' '))

def getString():
	return sys.stdin.readline().rstrip()

def printOutput(ans):
	sys.stdout.write('%i %i %i\n' % (ans[0], ans[1], ans[2]))

def solve(n, m, k, x, y):
	if n == 1:
		seats = [k // m for _ in range(m)]
		rem = k % m
		for i in range(len(seats)):
			if rem > 0:
				seats[i] += 1
				rem -= 1
		return (seats[0], seats[-1], seats[y - 1])
	seats = [[0 for _ in range(m)] for _ in range(n)]
	for i in range(len(seats)):
		for j in range(len(seats[0])):
			if k > 0:
				seats[i][j] = 1
				k -= 1
	partialq = k // ((n - 1) * m)
	front = (partialq + 1) // 2
	back = partialq // 2
	for i in range(len(seats)):
		for j in range(len(seats[0])):
			if i == 0:
				seats[i][j] += front
			elif i == len(seats) - 1:
				seats[i][j] += back
			else:
				seats[i][j] += partialq
	rem = k % ((n - 1) * m)
	if partialq % 2 == 1:
		for i in range(1, len(seats)):
			for j in range(len(seats[0])):
				if rem > 0:
					seats[i][j] += 1
					rem -= 1
	else:
		for i in range(len(seats) - 2, -1, -1):
			for j in range(len(seats[0])):
				if rem > 0:
					seats[i][j] += 1
					rem -= 1
	mx = MINNUM
	mn = MAXNUM
	for i in range(len(seats)):
		for j in range(len(seats[0])):
			mx = max(mx, seats[i][j])
			mn = min(mx, seats[i][j])
	sPos = seats[x - 1][y - 1]
	return (mx, mn, sPos)

def readinput():
	(n, m, k, x, y) = getInts()
	printOutput(solve(n, m, k, x, y))
readinput()


(n, m, k, x, y) = list(map(int, input().split()))
prohod = (2 * n - 2) * m
if n == 1:
	prohod = m
last = k % prohod
minimum = k // prohod
maximum = k // prohod * 2
line = []
a1 = 10000000000000000000000000
a2 = -10000000000000000000000000
for i in range(n):
	if i == 0 or i == n - 1:
		line += [minimum]
	else:
		line += [maximum]
ask = True
for i in range(n):
	if last >= m:
		last -= m
		line[i] += 1
	elif last > 0:
		if i == x - 1 and last < y:
			ask = False
		line[i] += 1
		a1 = min(a1, line[i] - 1)
		a2 = max(a2, line[i])
		last = 0
	else:
		a1 = min(a1, line[i])
		a2 = max(a2, line[i])
	a2 = max(a2, line[i])
	a1 = min(a1, line[i])
i = n - 2
while i > 0:
	if last >= m:
		last -= m
		line[i] += 1
	else:
		if last > 0:
			if i == x - 1 and last < y:
				ask = False
			line[i] += 1
			a1 = min(a1, line[i] - 1)
			a2 = max(a2, line[i])
			last = 0
		else:
			a1 = min(a1, line[i])
			a2 = max(a2, line[i])
		break
	a2 = max(a2, line[i])
	a1 = min(a1, line[i])
	i -= 1
a3 = line[x - 1]
if not ask:
	a3 -= 1
print(a2, a1, a3)


def solve(n, m, k, x, y):
	(minv, maxv, curv) = (0, 0, 0)
	if n == 1:
		minv = k // m
		maxv = minv
		curv = minv
		q = k % m
		if q > 0:
			maxv += 1
			if q >= y:
				curv += 1
	elif n == 2:
		minv = k // (m * 2)
		maxv = minv
		curv = minv
		q = k % (m * 2)
		if q > 0:
			maxv += 1
			if q >= (x - 1) * m + y:
				curv += 1
	else:
		t = n * m * 2 - 2 * m
		com = k // t
		minv = com
		maxv = com * 2
		curv = com
		if x != n and x != 1:
			curv += com
		q = k % t
		if q > 0:
			if q > m or com == 0:
				maxv += 1
			if q > n * m:
				maxv += 1
			if q >= n * m:
				minv += 1
			p1 = (x - 1) * m + y
			if q >= p1:
				curv += 1
				if x != 1 and x != n:
					p2 = t - (x - 1) * m + y
					if q >= p2:
						curv += 1
	return (maxv, minv, curv)
(n, m, k, x, y) = map(int, input().split())
print(' '.join(map(str, solve(n, m, k, x, y))))


def main():
	(n, m, k, x, y) = map(int, input().split())
	x -= 1
	y -= 1
	if n == 1:
		ever = [k // m for i in range(m)]
		k %= m
		for i in range(k):
			ever[i] += 1
		print(max(ever), min(ever), ever[y])
		return
	per_leng = m * (2 * n - 2)
	per_num = k // per_leng
	every_raw = [2 * per_num for i in range(n)]
	every_raw[0] -= per_num
	if every_raw[-1] == 2 * per_num:
		every_raw[-1] -= per_num
	k %= per_leng
	curr_raw = 0
	dire = 0
	while k >= m:
		every_raw[curr_raw] += 1
		if dire == 0:
			if curr_raw + 1 < n:
				curr_raw += 1
			else:
				dire = 1
				curr_raw -= 1
		else:
			curr_raw -= 1
		k -= m
	if k == 0:
		print(max(every_raw), min(every_raw), every_raw[x])
	else:
		spec = [every_raw[curr_raw] for i in range(m)]
		for i in range(k):
			spec[i] += 1
		all_arr = []
		for i in range(n):
			if i != curr_raw:
				all_arr.append(every_raw[i])
			else:
				all_arr += spec
		print(max(all_arr), min(all_arr), end=' ')
		if x == curr_raw:
			print(spec[y])
		else:
			print(every_raw[x])
main()


(n, m, k, x, y) = list(map(int, input().split()))
rw = [0] * n
pl = [[0] * m for r in range(n)]

def call():
	nonlocal k, rw, pl
	if n == 1:
		(a, b) = (k // m, k % m)
		for i in range(m):
			pl[0][i] = a
		for i in range(b):
			pl[0][i] += 1
		return
	if k >= 30000:
		ite = 2 * m * (n - 1)
		t = k // ite
		for i in range(n):
			rw[i] += 2 * t
		rw[0] -= t
		rw[-1] -= t
		k -= t * ite
	act = 0
	up = 1
	while 1:
		if k > m:
			rw[act] += 1
			if up:
				act += 1
			else:
				act -= 1
			if act == n:
				act = n - 2
				up = 0
			if act == -1:
				act = 1
				up = 1
			k -= m
		else:
			for i in range(k):
				pl[act][i] += 1
			return
call()
for i in range(n):
	for j in range(m):
		pl[i][j] += rw[i]
mxges = max([max(pl[i]) for i in range(n)])
mnges = min([min(pl[i]) for i in range(n)])
gg = pl[x - 1][y - 1]
print('{} {} {}'.format(mxges, mnges, gg))


(n, m, k, x, y) = list(map(int, input().split()))
if n == 1:
	mod = m
else:
	mod = (2 * n - 2) * m
(cnt, rem) = divmod(k, mod)
ans = [[0 for _ in range(m)] for _ in range(n)]
ans[0] = [cnt for _ in range(m)]
ans[n - 1] = [cnt for _ in range(m)]
for i in range(1, n - 1):
	for j in range(m):
		ans[i][j] = 2 * cnt
for i in range(n):
	for j in range(m):
		if rem > 0:
			ans[i][j] += 1
			rem -= 1
if n > 1:
	for i in range(n - 2, 0, -1):
		for j in range(m):
			if rem > 0:
				ans[i][j] += 1
				rem -= 1
mx = max((max(ans[i]) for i in range(n)))
mn = min(min((ans[i] for i in range(n))))
srg = ans[x - 1][y - 1]
print(mx, mn, srg)


(n, m, k, x, y) = map(int, input().split(' '))

def s(row, col):
	ret = 0
	if l % 2 == 0:
		if row == n or row == 1:
			ret = l // 2
		else:
			ret = l
		if rl >= row or (rl + 1 == row and col <= rr):
			ret += 1
	else:
		if row == n:
			ret = (l - 1) // 2
		elif row == 1:
			ret = (l + 1) // 2
		else:
			ret = l
		if n - rl < row or (n - rl == row and col <= rr):
			ret += 1
	return ret
if n == 1:
	r = k // m
	rr = k % m
	if rr > 0:
		maxi = r + 1
	else:
		maxi = r
	mini = r
	if y <= rr:
		sergei = r + 1
	else:
		sergei = r
else:
	r = k // m
	rr = k % m
	l = r // (n - 1)
	rl = r % (n - 1)
	if l % 2 == 0:
		maxi = max(s(2, 1), s(1, 1))
		mini = s(n, 1)
	else:
		maxi = max(s(n - 1, 1), s(1, 1))
		mini = s(n, m)
	sergei = s(x, y)
print(maxi, mini, sergei)


def main():
	(n, m, k, x, y) = list(map(int, input().split()))
	A = [[0] * m for i in range(n)]
	MOD = (2 * n - 2) * m
	if n > 1:
		for i in range(m):
			A[0][i] += k // MOD
			A[-1][i] += k // MOD
		for i in range(1, n - 1):
			for j in range(m):
				A[i][j] += 2 * (k // MOD)
		k %= MOD
		for i in range(n):
			for j in range(m):
				if k > 0:
					A[i][j] += 1
					k -= 1
		for i in range(n - 2, -1, -1):
			for j in range(m):
				if k > 0:
					A[i][j] += 1
					k -= 1
	else:
		MOD = m
		for i in range(m):
			A[0][i] = k // MOD
		k %= MOD
		for i in range(m):
			if k > 0:
				A[0][i] += 1
				k -= 1
	maxx = -1
	minn = 10 ** 100
	for row in A:
		maxx = max(maxx, max(row))
		minn = min(minn, min(row))
	print(maxx, minn, A[x - 1][y - 1])
main()


(n, m, k, x, y) = tuple(map(int, input().split()))
maxq = minq = sergeiq = 0
if n == 1:
	maxq = k // m
	if k % m > 0:
		maxq += 1
		minq = maxq - 1
		if y <= k % m:
			sergeiq = maxq
		else:
			sergeiq = minq
	else:
		minq = maxq
		sergeiq = minq
elif n == 2:
	maxq = minq = sergeiq = k // (2 * m)
	if k % (2 * m) > 0:
		maxq += 1
		if x == 1 and y <= k % (2 * m):
			sergeiq += 1
		elif x == 2 and k % (2 * m) >= y + m:
			sergeiq += 1
elif k < n * m:
	maxq = 1
	minq = 0
	if k / m >= x:
		sergeiq = 1
	elif k / m <= x - 1:
		sergeiq = 0
	elif k % m >= y:
		sergeiq = 1
	else:
		sergeiq = 0
elif k == n * m:
	maxq = 1
	minq = 1
	sergeiq = 1
else:
	maxq = 2 * (k // (m * 2 * (n - 1)))
	minq = k // (m * 2 * (n - 1))
	if x == 1 or x == n:
		sergeiq = minq
	else:
		sergeiq = maxq
	remainder = k % (m * 2 * (n - 1))
	if remainder > 0:
		if remainder <= m:
			if x == 1 and y <= remainder:
				sergeiq += 1
		elif remainder <= m * n:
			maxq += 1
			if x <= remainder / m:
				sergeiq += 1
			elif x - 1 < remainder / m and remainder % m >= y:
				sergeiq += 1
			if remainder == m * n:
				minq += 1
		else:
			maxq += 2
			sergeiq += 1
			minq += 1
			if x != 1 and x != n:
				if (remainder - n * m) / m >= n - x:
					sergeiq += 1
				elif (remainder - n * m) / m > n - x - 1 and (remainder - n * m) % m >= y:
					sergeiq += 1
print(str(maxq) + ' ' + str(minq) + ' ' + str(sergeiq))


(n, m, k, x, y) = [int(x) for x in input().split()]
maxi = 0
mini = 0
ser = 0
if n == 1:
	if k % m == 0:
		maxi = k // m
		mini = k // m
		ser = k // m
	else:
		maxi = k // m + 1
		mini = k // m
		if y <= k % m:
			ser = maxi
		else:
			ser = mini
	print(maxi, mini, ser)
	exit(0)
if n == 2:
	if k % (2 * m) == 0:
		maxi = k // (2 * m)
		mini = k // (2 * m)
		ser = k // (2 * m)
	else:
		maxi = k // (2 * m) + 1
		mini = k // (2 * m)
		if (x - 1) * m + y <= k % (2 * m):
			ser = maxi
		else:
			ser = mini
	print(maxi, mini, ser)
	exit(0)
if k < (2 * n - 2) * m:
	if k < n * m:
		maxi = 1
		mini = 0
		if (x - 1) * m + y <= k:
			ser = 1
		else:
			ser = 0
	elif k == n * m:
		maxi = 1
		mini = 1
		ser = 1
	else:
		maxi = 2
		mini = 1
		if x == 1 or x == n:
			ser = 1
		elif k - n * m >= y + (n - 1 - x) * m:
			ser = 2
		else:
			ser = 1
	print(maxi, mini, ser)
else:
	mini = k // ((2 * n - 2) * m)
	maxi = 2 * mini
	if k % ((2 * n - 2) * m) > m:
		if k % ((2 * n - 2) * m) > m * n:
			maxi += 2
			mini += 1
		else:
			maxi += 1
		if k % ((2 * n - 2) * m) == m * n:
			mini += 1
	if x == 1:
		ser = k // ((2 * n - 2) * m)
		if k % ((2 * n - 2) * m) >= y:
			ser += 1
	elif x == n:
		ser = k // ((2 * n - 2) * m)
		if k % ((2 * n - 2) * m) >= y + (n - 1) * m:
			ser += 1
	elif k % ((2 * n - 2) * m) <= n * m:
		if (x - 1) * m + y <= k % ((2 * n - 2) * m):
			ser = k // ((2 * n - 2) * m) * 2 + 1
		else:
			ser = k // ((2 * n - 2) * m) * 2
	else:
		ser = k // ((2 * n - 2) * m) * 2 + 1
		if k % ((2 * n - 2) * m) - n * m >= (n - 1 - x) * m + y:
			ser += 1
	print(maxi, mini, ser)


import pdb
import sys

def isQpassSergei(studens_in_column, SergeiX, SergeiY, left_questions):
	return True if (SergeiX - 1) * studens_in_column + SergeiY - 1 < left_questions else False

def isYpassSergei(column, studens_in_column, SergeiX, SergeiY, left_questions):
	left_questions -= column * studens_in_column
	if left_questions == 0:
		return False
	if SergeiX == column:
		return False
	return True if (column - SergeiX - 1) * studens_in_column + SergeiY <= left_questions else False
(rows, studens_in_column, questions, SergeiX, SergeiY) = map(int, input().split())
min_question = 0
max_question = 0
sergei_question = 0
if rows == 1:
	min_question = questions // studens_in_column
	max_question = min_question + 1 if questions % studens_in_column != 0 else min_question
	sergei_question = min_question if questions % studens_in_column < SergeiY else max_question
	print(max_question, min_question, sergei_question)
	sys.exit(0)
min_question = questions // ((2 * rows - 2) * studens_in_column)
max_question = 2 * min_question
left_questions = questions % ((2 * rows - 2) * studens_in_column)
sergei_question = min_question if SergeiX == rows or SergeiX == 1 else max_question
xx = 0
if left_questions == 0 and rows != 2:
	xx
elif rows == 2:
	max_question = min_question
	if left_questions == 0:
		xx
	elif left_questions < rows * studens_in_column:
		if left_questions < studens_in_column:
			max_question = max_question + 1
			sergei_question = min_question + 1 if isQpassSergei(studens_in_column, SergeiX, SergeiY, left_questions) else min_question
		else:
			max_question = min_question + 1
			sergei_question = min_question + 1 if isQpassSergei(studens_in_column, SergeiX, SergeiY, left_questions) else min_question
	else:
		sergei_question = min_question = max_question = min_question + 1
elif left_questions < rows * studens_in_column:
	if max_question == 0 and left_questions != 0:
		max_question += 1
	elif left_questions > studens_in_column:
		max_question += 1
	sergei_question = sergei_question + 1 if isQpassSergei(studens_in_column, SergeiX, SergeiY, left_questions) else sergei_question
else:
	max_question = max_question + 1 if left_questions == rows * studens_in_column else max_question + 2
	min_question += 1
	sergei_question = sergei_question + 2 if isYpassSergei(rows, studens_in_column, SergeiX, SergeiY, left_questions) else sergei_question + 1
print(max_question, min_question, sergei_question)


(n, m, k, x, y) = map(int, input().split())
mat = [[0 for i in range(m)] for j in range(n)]

def printMatrix(matrix):
	s = [[str(e) for e in row] for row in matrix]
	lens = [max(map(len, col)) for col in zip(*s)]
	fmt = '\t'.join(('{{:{}}}'.format(x) for x in lens))
	table = [fmt.format(*row) for row in s]
	print('_________________')
	print('\n'.join(table))
	print('`````````````````')
if n == 1:
	done = True
	(div, mod) = divmod(k, m)
	for j in range(m):
		mat[0][j] = div
		if mod:
			mat[0][j] += 1
			mod -= 1
elif n * m >= k:
	for i in range(n - 1, -1, -1):
		for j in range(m):
			if k:
				mat[i][j] += 1
				k -= 1
else:
	k -= n * m
	(div, mod) = divmod(k, (n - 1) * m * 2)
	for i in range(n):
		for j in range(m):
			if i == 0 or i == n - 1:
				mat[i][j] += div
			else:
				mat[i][j] += div * 2
			mat[i][j] += 1
	for i in range(1, n):
		for j in range(m):
			if mod:
				mat[i][j] += 1
				mod -= 1
	for i in range(n - 2, -1, -1):
		for j in range(m):
			if mod:
				mat[i][j] += 1
				mod -= 1
MAX = 0
MIN = 10000000000000000000000000
for i in range(n):
	for j in range(m):
		MAX = max(MAX, mat[i][j])
		MIN = min(MIN, mat[i][j])
print(MAX, MIN, mat[n - x][y - 1])


(n, m, k, x, y) = map(int, input().split())
t = 0
if n > 1:
	t = k // (m * (n - 1) * 2)
	ans = [[2 * t for i in range(m)] for j in range(n)]
	for j in range(m):
		ans[0][j] //= 2
		ans[n - 1][j] //= 2
	now = 0
	for i in range(n):
		now += sum(ans[i])
	k -= now
	for i in range(n):
		for j in range(m):
			if k:
				ans[i][j] += 1
				k -= 1
	if k:
		for i in range(n - 2, -1, -1):
			for j in range(m):
				if k:
					k -= 1
					ans[i][j] += 1
else:
	t = k // m
	ans = [[t for i in range(m)] for j in range(n)]
	k -= sum(ans[0])
	for i in range(m):
		if k:
			k -= 1
			ans[0][i] += 1
x -= 1
y -= 1
maxx = -1
minn = 1e+19
for i in range(n):
	maxx = max(maxx, max(ans[i]))
	minn = min(minn, min(ans[i]))
print(maxx, minn, ans[x][y])


(n, m, k, xx, yy) = map(int, input().split())
if n != 1:
	plus = k // ((n * 2 - 2) * m)
	k %= (n * 2 - 2) * m
	l = [[plus * 2 for p in range(m)] for pp in range(n)]
	for t in range(m):
		l[0][t] -= plus
		l[-1][t] -= plus
else:
	plus = k // m
	l = [[plus for p in range(m)]]
	k %= m
x = y = s = 0
d = 1 if n != 1 else 0
for t in range(k):
	l[x][y] += 1
	if y == m - 1:
		y = 0
		if x + d == -1:
			d = -d
			x += d
		elif x + d == n:
			d = -d
			x += d
		else:
			x += d
	else:
		y += 1
print(max(max(l, key=lambda tt: max(tt))), min(min(l, key=lambda tt: min(tt))), l[xx - 1][yy - 1])


import sys
(n, m, k, x, y) = map(int, input().split())

def max_min(l, n, m):
	ma = 0
	mi = 900000000000000000000
	for i in range(0, n):
		for j in range(0, m):
			if l[i][j] > ma:
				ma = l[i][j]
			if l[i][j] < mi:
				mi = l[i][j]
	return (ma, mi)

def unfair(n, m, k, x, y):
	pupils = [[None] * m for i in range(n)]
	c = (n + max(0, n - 2)) * m
	vueltas = k // c
	k = k % c
	for i in range(0, n):
		for j in range(0, m):
			if i == 0 or i == n - 1:
				pupils[i][j] = vueltas
			else:
				pupils[i][j] = vueltas * 2
	regreso = False
	naux = 0
	maux = 0
	while k:
		pupils[naux][maux] += 1
		maux += 1
		if maux == m:
			maux = 0
			if regreso:
				naux -= 1
			else:
				naux += 1
			if naux == n:
				regreso = True
				naux -= 2
		k -= 1
	m = max_min(pupils, n, m)
	print(m[0], m[1], pupils[x - 1][y - 1])
unfair(n, m, k, x, y)


(n, m, k, x, y) = map(int, input().split())
(ans1, ans2, ans3) = (1, 0, 0)
if n == 1:
	ans2 = k // m
	k %= m
	ans1 = ans2 + (1 if k > 0 else 0)
	ans3 = ans2 + (1 if y <= k else 0)
else:
	counter = [0] * n
	more_rows = k // m
	k %= m
	looplen = 2 * (n - 1) if n > 1 else 1
	loops = more_rows // looplen
	more_rows %= looplen
	(located, direction) = (0, 1)
	for i in range(looplen):
		counter[located] += loops
		located += direction
		if located == n - 1:
			direction = -1
		elif located == 0:
			direction = 1
	for i in range(more_rows):
		counter[located] += 1
		located += direction
		if located == n - 1:
			direction = -1
		elif located == 0:
			direction = 1
	(ans1, ans2) = (max(counter), min(counter))
	ans3 = counter[x - 1]
	if y <= k and located == x - 1:
		ans3 += 1
	if k > 0:
		counter[located] += 1
		ans1 = max(counter)
print(ans1, ans2, ans3)


from sys import stdin
import math
(n, m, k, x, y) = map(int, stdin.readline().rstrip().split())
tour_size = 2 * n * m - 2 * m if n > 1 else m
max_asked_per_tour = 2 if n >= 3 else 1
min_asked_per_tour = 1
last_tour_count = k % tour_size
max_asked = max(k // tour_size * max_asked_per_tour + (0 if last_tour_count <= m else 1 if m < last_tour_count <= m * n else 2), math.ceil(k / tour_size))
min_asked = k // tour_size * min_asked_per_tour + (1 if last_tour_count >= n * m else 0)
asked_per_tour = 2 if 1 < x < n else 1
pre_tour_pos = (x - 1) * m + y
pos_tour_pos = -1 if asked_per_tour == 1 else m * n + (n - x - 1) * m + y
last_pre_tour_asked = 0 if k % tour_size < pre_tour_pos else 1
last_pos_tour_asked = 0 if pos_tour_pos == -1 or k % tour_size < pos_tour_pos else 1
sergei_asked = k // tour_size * asked_per_tour + last_pre_tour_asked + last_pos_tour_asked
print(' '.join(map(str, [max_asked, min_asked, sergei_asked])))


(n, m, k, x, y) = [int(x) for x in input().split()]
ma = 0
mi = 0
minn = 199999999999999999
maxx = -1
if n is 1:
	mi = k // m
	ma = mi
	k = k % m
	a = [0] * m
	for p in range(m):
		if k is 0:
			break
		a[p] = 1
		k -= 1
	for p in range(m):
		if a[p] > maxx:
			maxx = a[p]
		if a[p] < minn:
			minn = a[p]
	print(ma + maxx, mi + minn, mi + a[y - 1])
else:
	i = (2 * n - 2) * m
	mi = k // i
	if n > 2:
		ma = mi * 2
	else:
		ma = mi
	k = k % i
	a = [[0 for p in range(m)] for q in range(n)]
	for p in range(n):
		for q in range(m):
			if p is 0 or p is n - 1:
				a[p][q] = mi
			else:
				a[p][q] = ma
	for p in range(n):
		if k is 0:
			break
		for q in range(m):
			if k is 0:
				break
			a[p][q] += 1
			k -= 1
	for p in range(n):
		if k is 0:
			break
		for q in range(m):
			if k is 0:
				break
			a[n - 2 - p][q] += 1
			k -= 1
	for p in range(n):
		for q in range(m):
			if a[p][q] > maxx:
				maxx = a[p][q]
			if a[p][q] < minn:
				minn = a[p][q]
	if x is 1 or x is n:
		print(maxx, minn, a[x - 1][y - 1])
	else:
		print(maxx, minn, a[x - 1][y - 1])


def get(n, m, k):
	if n == 1:
		ans = [[k // m for i in range(m)]]
		k %= m
		for i in range(k):
			ans[0][i] += 1
		return ans
	full = (2 * n - 2) * m
	ans = [[(2 - int(i == 0 or i == n - 1)) * (k // full) for j in range(m)] for i in range(n)]
	k %= full
	for i in range(n):
		for j in range(m):
			if k != 0:
				ans[i][j] += 1
				k -= 1
	for i in range(n - 2, 0, -1):
		for j in range(m):
			if k != 0:
				ans[i][j] += 1
				k -= 1
	return ans
(n, m, k, x, y) = map(int, input().split())
a = get(n, m, k)
mns = [min(a[i]) for i in range(n)]
mxs = [max(a[i]) for i in range(n)]
print(max(mxs), min(mns), a[x - 1][y - 1])


import math
(n, m, k, x, y) = map(int, input().split())
if n < 3:
	(ma, mi) = (math.ceil(k / (n * m)), k // (n * m))
	s = ma if k % (n * m) >= (x - 1) * m + y else mi
	print(ma, mi, s)
else:
	(t, mo) = (k // ((2 * n - 2) * m), k % ((2 * n - 2) * m))
	if mo > n * m:
		ma = 2 * t + 2
		mi = t + 1
	elif mo == n * m:
		ma = 2 * t + 1
		mi = t + 1
	elif mo > (n - 1) * m:
		ma = 2 * t + 1
		mi = t
	elif mo > m:
		ma = 2 * t + 1
		mi = t
	else:
		ma = max(2 * t, t + 1)
		mi = t
	if x == 1 or x == n:
		if mo >= (x - 1) * m + y:
			s = t + 1
		else:
			s = t
	elif mo >= n * m + (n - x - 1) * m + y:
		s = 2 * t + 2
	elif mo >= (x - 1) * m + y:
		s = 2 * t + 1
	else:
		s = 2 * t
	print(ma, mi, s)


import math
import sys

def printf(*a):
	if len(sys.argv) > 1:
		print(a)
(n, m, k, x, y) = map(int, input().split())
mi = 0
ma = 0
serg = 0
filed_lines = k // m
partial_line = k % m
printf(filed_lines, partial_line)
if n == 1:
	mi = filed_lines
	ma = filed_lines
	if partial_line > 0:
		ma += 1
	if y <= partial_line:
		serg = ma
	else:
		serg = mi
else:
	filed_class = filed_lines // (n - 1)
	partial_class = filed_lines % (n - 1)
	printf(filed_class, partial_class)
	if filed_class % 2 == 1:
		mi = (filed_class - 1) // 2
		if partial_class > 0:
			mi += 1
	else:
		mi = filed_class // 2
	if k <= m:
		ma = 1
	else:
		if n == 2:
			ma = filed_class // 2
			if partial_line > 0:
				ma += 1
		else:
			ma = filed_class
		if partial_class > 1 or (partial_class == 1 and partial_line > 0):
			ma += 1
	if x == 1:
		if filed_class % 2 == 1:
			serg = filed_class // 2 + 1
			if partial_class == n - 1 and partial_line >= y:
				serg += 1
		else:
			serg = filed_class // 2
			if partial_class > 0 or (partial_class == 0 and partial_line >= y):
				serg += 1
	elif x == n:
		if filed_class % 2 == 0:
			serg = filed_class // 2
			if partial_class == n - 1 and partial_line >= y:
				serg += 1
		else:
			serg = filed_class // 2
			if partial_class > 0 or (partial_class == 0 and partial_line >= y):
				serg += 1
	else:
		if filed_class % 2 == 1:
			x = n - x + 1
		if x <= partial_class:
			serg = filed_class + 1
		elif x == partial_class + 1 and y <= partial_line:
			serg = filed_class + 1
		else:
			serg = filed_class
print('{} {} {}'.format(ma, mi, serg))


(n, m, k, x, y) = list(map(int, input().strip().split()))
if n == 1:
	numberinacycle = m
else:
	numberinacycle = 2 * m + 2 * (n - 2) * m
numcycles = k // numberinacycle
remainder = k % numberinacycle
grid = [[numcycles for _ in range(m)] for _ in range(n)]
for i in range(1, n - 1):
	grid[i] = [2 * numcycles for _ in range(m)]
(i, j) = (0, 0)
r = min(remainder, m * n)
while r > 0:
	if j == m:
		j = 0
		i += 1
	grid[i][j] += 1
	j += 1
	r -= 1
r = remainder - m * n
(i, j) = (n - 2, 0)
while r > 0:
	if j == m:
		j = 0
		i -= 1
	grid[i][j] += 1
	j += 1
	r -= 1
minq = min(map(min, grid))
maxq = max(map(max, grid))
sergei = grid[x - 1][y - 1]
print(str(maxq) + ' ' + str(minq) + ' ' + str(sergei))


(n, m, k, x, y) = map(int, input().split())
allnum = 0
allnum = 2 * n * m - 2 * m
if n <= 2:
	allnum = 2 * n * m
num = 2 * (k // allnum)
r = k % allnum
g = [[num] * m for i in range(0, n)]
if n > 2:
	g[0] = [num // 2] * m
	g[n - 1] = [num // 2] * m
for i in range(0, n):
	for j in range(0, m):
		if r == 0:
			break
		g[i][j] += 1
		r -= 1
	if r == 0:
		break
for i in range(max(n - 2, 0), -1, -1):
	for j in range(0, m):
		if r == 0:
			break
		g[i][j] += 1
		r -= 1
	if r == 0:
		break
mn = num + 1000000000000000
mx = 0
for i in range(0, n):
	if max(g[i]) > mx:
		mx = max(g[i])
	if min(g[i]) < mn:
		mn = min(g[i])
print(mx, mn, g[x - 1][y - 1])


(n, m, k, x, y) = list(map(int, input().split()))
if n == 1:
	cnt = k // m
	k %= m
else:
	cnt = k // (2 * m * (n - 1))
	k %= 2 * m * (n - 1)
q = [[2 * cnt] * m for i in range(n)]
q[0] = [cnt] * m
q[-1] = [cnt] * m
i = 0
j = 0
d = 1
while k > 0:
	q[i][j] += 1
	k -= 1
	j += 1
	if d == 1:
		i += j // m
		j %= m
	elif d == -1:
		i -= j // m
		j %= m
	if i == n:
		i = n - 2
		d = -1
gmin = 10 ** 18
gmax = 0
for line in q:
	gmin = min(gmin, min(line))
	gmax = max(gmax, max(line))
print(gmax, gmin, q[x - 1][y - 1])


import math

def maax(n, m, k):
	row = math.ceil(k / m)
	a = 2 * n - 2
	ans = 0
	if a == 0:
		ans = row
	elif a == 2:
		ans = math.ceil(row / 2)
	else:
		ans = 2 * (row // a)
		if row % a > 1 and row % a <= n:
			ans += 1
		elif row % a > n:
			ans += 2
		elif row % a >= 1 and ans == 0:
			ans += 1
	print(ans, end=' ')

def minn(n, m, k):
	row = k // m
	a = 2 * n - 2
	ans = 0
	if a == 0:
		ans = row
	elif a == 2:
		ans = math.floor(row / 2)
	else:
		ans = row // a
		if row % a >= n:
			ans += 1
	print(ans, end=' ')

def poss(n, m, k, x, y):
	a = k % m
	row = 0
	if y <= a or a == 0:
		row = math.ceil(k / m)
	else:
		row = k // m
	a = 2 * n - 2
	if a == 0:
		ans = row
	elif a == 2:
		ans = row // 2
		if x == 1 and row % 2 == 1:
			ans += 1
	elif x != 1 and x != n:
		ans = 2 * (row // a)
		if row % a >= x:
			ans += 1
		if row % a >= n + 1 and row % a >= 2 * n - x:
			ans += 1
	elif x == 1 or x == n:
		ans = row // a
		if row % a > 0 and x == 1:
			ans += 1
		elif row % a >= n and x == n:
			ans += 1
	print(ans)
(n, m, k, x, y) = map(int, input().split())
maax(n, m, k)
minn(n, m, k)
poss(n, m, k, x, y)


(n, m, k, x, y) = map(int, input().split())
if n == 1:
	if k % m == 0:
		print(k // m, k // m, k // m)
	elif k % m < y:
		print(k // m + 1, k // m, k // m)
	else:
		print(k // m + 1, k // m, k // m + 1)
else:
	maxx = 2 * (k // (2 * (n - 1) * m))
	minx = k // (2 * (n - 1) * m)
	k = k % (2 * (n - 1) * m)
	sinkr = x == n or x == 1
	field = list()
	field.append([minx for i in range(m)])
	for i in range(n - 2):
		field.append([maxx for i in range(m)])
	field.append([minx for i in range(m)])
	if k <= n * m:
		b = k
		while k != 0:
			aa = n * m - k
			field[(b - k) // m][(b - k) % m] += 1
			k -= 1
	else:
		k -= n * m
		for i in range(n):
			for j in range(m):
				field[i][j] += 1
		b = k
		while k != 0:
			aa = (n - 2) * m - k
			field[n - 2 - (b - k) // m][(b - k) % m] += 1
			k -= 1
	print(max(max(*field)), min(min(*field)), field[x - 1][y - 1])


(n, m, k, x, y) = map(int, input().split())
cycle = (2 * n - 2) * m if n > 1 else 2 * n * m
full_cycles = k // cycle
k = k % cycle
pupils = [[full_cycles if n > 1 and (i == 0 or i == n - 1) else 2 * full_cycles] * m for i in range(n)]
(i, j, diff) = (0, 0, +1)
while k > 0:
	pupils[i][j] += 1
	j += 1
	if j == m:
		(i, j) = (i + diff, 0)
		if i == n:
			diff = -1
			i = n - 2
	k -= 1
print('%i %i %i' % (max(map(max, pupils)), min(map(min, pupils)), pupils[x - 1][y - 1]))


def main():
	from itertools import chain, cycle
	(n, m, k, x, y) = map(int, input().split())
	if n == 1:
		(t, k) = divmod(k, m)
		l = cols = [[t] * m]
	else:
		(t, k) = divmod(k, (n - 1) * m * 2)
		l = [[t] * m, *[[t * 2] * m for _ in range(n - 2)], [t] * m]
		cols = [*l[:-1], *l[n - 1:0:-1]]
	for col in cycle(cols):
		for i in range(m):
			if not k:
				print(max(chain(*l)), min(chain(*l)), l[x - 1][y - 1])
				return
			col[i] += 1
			k -= 1
main()


(n, m, k, x, y) = list(map(int, input().split()))
if n == 1:
	t = m
elif m == 1:
	t = n + n - 2
else:
	t = n * m + (n - 2) * m
ma = -1
mi = 10 ** 30
a = [[0] * m for i in range(n)]
for i in range(n):
	for j in range(m):
		a[i][j] = k // t
		if i != 0 and i != n - 1:
			a[i][j] *= 2
k = k % t
for i in range(n):
	for j in range(m):
		if k > 0:
			a[i][j] += 1
			k -= 1
for i in range(n - 2, -1, -1):
	for j in range(m):
		if k > 0:
			a[i][j] += 1
			k -= 1
for i in range(n):
	for j in range(m):
		ma = max(ma, a[i][j])
		mi = min(mi, a[i][j])
print(ma, mi, a[x - 1][y - 1])


def main():
	(n, m, k, x, y) = map(int, input().split())
	if n == 1:
		if k % m == 0:
			print(k // m, k // m, k // m)
		else:
			vl = k // m
			if y <= k % m:
				vl = k // m + 1
			print(k // m + 1, k // m, vl)
		return
	ma = -1 * 10 ** 20
	mi = 10 ** 20
	track = 0
	ans = 0
	xloc = 0
	yloc = 0
	for i in range(1, n + 1):
		increment1 = 2 * (n - i) * m
		increment2 = 2 * (i - 1) * m
		for j in range(1, m + 1):
			lo = -1
			hi = 10 ** 18
			while hi - lo > 1:
				mid = (lo + hi) // 2
				times2 = mid // 2
				if increment2 == 0:
					times2 = 0
				times1 = mid - times2
				if increment1 == 0:
					times1 = 0
					times2 = mid
				sumtotal = (i - 1) * m + j + increment1 * times1 + increment2 * times2
				if sumtotal <= k:
					lo = mid
				else:
					hi = mid - 1
			times2 = hi // 2
			if increment2 == 0:
				times2 = 0
			times1 = hi - times2
			if increment1 == 0:
				times1 = 0
				times2 = hi
			sumtotal = (i - 1) * m + j + increment1 * times1 + increment2 * times2
			if sumtotal <= k:
				ans = hi + 1
			else:
				ans = hi
			if i == x and j == y:
				track = ans
			if ans > ma:
				ma = ans
			if ans < mi:
				mi = ans
	print(ma, mi, track)
	return
main()


(n, m, k, x, y) = [int(x) for x in input().split()]

def questions(x, y, n=n, m=m, k=k):
	if n == 1:
		cycle = k // m
		if k - cycle * m >= (x - 1) * m + y:
			return cycle + 1
		else:
			return cycle
	cycle = k // (2 * m * (n - 1))
	if x == 1 or x == n:
		if k - 2 * m * (n - 1) * cycle >= (x - 1) * m + y:
			return cycle + 1
		else:
			return cycle
	else:
		temp = 0
		if k - 2 * m * (n - 1) * cycle >= (x - 1) * m + y:
			temp += 1
		if k - 2 * m * (n - 1) * cycle >= n * m + (n - x - 1) * m + y:
			temp += 1
		return 2 * cycle + temp
if n == 1:
	print(questions(1, 1), questions(1, m), questions(x, y))
else:
	ma = max(questions(1, 1), questions(2, 1), questions(n - 1, 1))
	mi = questions(n, m)
	me = questions(x, y)
	print(ma, mi, me)


(n, m, k, x, y) = map(int, input().split())
temp = k // m
if n == 1:
	ans1 = temp
	ans2 = temp
	if k % m > 0:
		ans1 += 1
	print(ans1, ans2, end=' ')
	if y <= k % m:
		print(ans1)
	else:
		print(ans2)
else:
	div = temp // (n - 1)
	a = []
	for i in range(0, n):
		a.append(0)
	div //= 2
	for i in range(0, n):
		a[i] += div * m
	for i in range(1, n - 1):
		a[i] += div * m
	temp = k
	temp -= div * 2 * (n - 1) * m
	while temp > 0:
		for i in range(0, n - 1):
			a[i] += min(m, temp)
			temp -= min(m, temp)
			if temp == 0:
				break
		if temp == 0:
			break
		for i in range(n - 1, 0, -1):
			a[i] += min(m, temp)
			temp -= min(m, temp)
			if temp == 0:
				break
		if temp == 0:
			break
	ans1 = max(a) // m
	ans2 = min(a) // m
	if max(a) % m > 0:
		ans1 += 1
	print(ans1, ans2, end=' ')
	ans = a[x - 1] // m
	if y <= a[x - 1] % m:
		ans += 1
	print(ans)


(n, m, k, x, y) = map(int, input().split())
matrix = [[0] * m for i in range(n)]
in_cycle = (n + n - 2) * m
if n == 1:
	in_cycle = m
	for i in range(m):
		matrix[0][i] += k // in_cycle
	k %= in_cycle
	for i in range(m):
		if k > 0:
			matrix[0][i] += 1
			k -= 1
	mx = -1
	mn = 10 ** 19
	for i in matrix:
		mx = max(mx, max(i))
		mn = min(mn, min(i))
	print(mx, mn, matrix[x - 1][y - 1])
else:
	for i in range(m):
		matrix[0][i] += k // in_cycle
		matrix[-1][i] += k // in_cycle
	for i in range(1, n - 1):
		for j in range(m):
			matrix[i][j] += k // in_cycle * 2
	k %= in_cycle
	for i in range(n):
		for j in range(m):
			if k > 0:
				matrix[i][j] += 1
				k -= 1
	for i in range(n - 2, -1, -1):
		for j in range(m):
			if k > 0:
				matrix[i][j] += 1
				k -= 1
	mx = -1
	mn = 10 ** 19
	for i in matrix:
		mx = max(mx, max(i))
		mn = min(mn, min(i))
	print(mx, mn, matrix[x - 1][y - 1])


from sys import stdin, stdout
(n, m, k, x, y) = map(int, stdin.readline().split())
values = [[0 for i in range(m)] for j in range(n)]
(mn, mx) = (k, 0)
if k > n * m:
	for i in range(n):
		for j in range(m):
			values[i][j] += 1
	k -= n * m
	if n != 1:
		cnt = k // (2 * (n - 1) * m)
		for i in range(n):
			for j in range(m):
				if not i or i == n - 1:
					values[i][j] += cnt
				else:
					values[i][j] += cnt * 2
		k %= 2 * (n - 1) * m
		for i in range(n - 2, -1, -1):
			for j in range(m):
				if k:
					values[i][j] += 1
					k -= 1
		for i in range(1, n):
			for j in range(m):
				if k:
					values[i][j] += 1
					k -= 1
	else:
		cnt = k // m
		for i in range(n):
			for j in range(m):
				values[i][j] += cnt
		k %= m
		for i in range(n):
			for j in range(m):
				if k:
					values[i][j] += 1
					k -= 1
else:
	for i in range(n):
		for j in range(m):
			if k:
				values[i][j] += 1
				k -= 1
ans = values[x - 1][y - 1]
for i in range(n):
	for j in range(m):
		if values[i][j] > mx:
			mx = values[i][j]
		if values[i][j] < mn:
			mn = values[i][j]
stdout.write(str(mx) + ' ' + str(mn) + ' ' + str(ans))


from fractions import gcd
from heapq import *
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7

def main():
	(n, m, k, x, y) = map(int, input().split())
	grid = [[0 for i in range(m)] for j in range(n)]
	if n == 1:
		V = k // m
		grid = [V] * m
		for i in range(k - m * (k // m)):
			grid[i] += 1
		print(max(grid), min(grid), grid[y - 1])
		exit()
	A = (k - n * m) // (2 * m * (n - 1)) + 1
	B = 1 + (A - 1) * 2
	C = k - (n * m + (A - 1) * (n - 1) * m * 2)
	for i in range(n):
		for j in range(m):
			if i == 0 or i == n - 1:
				grid[i][j] = A
			else:
				grid[i][j] = B
	while C > 0:
		for i in range(n - 2, -1, -1):
			for j in range(m):
				if C == 0:
					break
				grid[i][j] += 1
				C -= 1
			if C == 0:
				break
		for i in range(1, n):
			for j in range(m):
				if C == 0:
					break
				grid[i][j] += 1
				C -= 1
			if C == 0:
				break
	(ma, mi, ser) = (-1, float('inf'), 0)
	for i in range(n):
		for j in range(m):
			if ma < grid[i][j]:
				ma = grid[i][j]
			if mi > grid[i][j]:
				mi = grid[i][j]
			if i == x - 1 and j == y - 1:
				ser = grid[i][j]
	print(ma, mi, ser)
main()


def solve(n, m, k, x, y):
	if n <= 2:
		cycle = n * m
		(q1, q2, q3, k) = (k // cycle, k // cycle, k // cycle, k % cycle)
		q1 += k > 0
		q3 += k >= m * (x - 1) + y
		return (q1, q2, q3)
	else:
		cycle = (2 * n - 2) * m
		if k < cycle:
			q1 = int(k > 0) + int(k > n * m)
			q2 = int(k >= n * m)
			q3 = int(k >= m * (x - 1) + y) + int(x < n and k >= m * (2 * n - x - 1) + y)
			return (q1, q2, q3)
		(q1, q2, k) = (2 * (k // cycle), k // cycle, k % cycle)
		q3 = q1 if 1 < x < n else q2
		q1 += (k > m) + (k > n * m)
		q2 += k >= n * m
		q3 += (k >= m * (x - 1) + y) + (x < n and k >= m * (2 * n - x - 1) + y)
		return (q1, q2, q3)
(n, m, k, x, y) = map(int, input().split())
(q1, q2, q3) = solve(n, m, k, x, y)
print(q1, q2, q3)


import sys
(n, m, k, x, y) = map(int, input().split())
if n == 1:
	max_q = k // m + (k % m != 0)
	min_q = k // m
	serg_q = k // m + (y <= k % m)
	pass
else:
	num_q = [[0] * m for i in range(n)]
	loop = k // ((2 * n - 2) * m)
	for i in range(n):
		for j in range(m):
			if i == 0 or i == n - 1:
				num_q[i][j] = loop
			else:
				num_q[i][j] = 2 * loop
	amari = k % ((2 * n - 2) * m)
	zenhan = min((n - 1) * m, amari)
	kouhan = max(amari - (n - 1) * m, 0)
	for i in range(zenhan):
		num_q[i // m][i % m] += 1
	for i in range(kouhan):
		num_q[n - 1 - i // m][i % m] += 1
	max_q = -1
	min_q = float('inf')
	for i in range(n):
		max_q = max(max_q, max(num_q[i]))
		min_q = min(min_q, min(num_q[i]))
	serg_q = num_q[x - 1][y - 1]
	pass
print(max_q, min_q, serg_q)


(n, m, k, x, y) = list(map(int, input().split()))
if n > 2:
	if n * m < k:
		b = (k - n * m) // ((n - 1) * m)
		k = k - n * m - b * (n - 1) * m
		m2 = b + 1
		m1 = (m2 + 1) // 2
		if x == 1 or x == n:
			m3 = m1
		else:
			m3 = m2
		if b % 2 == 0:
			i = n - 1
			c = -1
		else:
			if x == 1:
				m3 = m3 + 1
			i = 2
			c = 1
		j = 1
		if k > 0:
			m2 = m2 + 1
		while k > 0:
			if x == i and y == j:
				m3 = m3 + 1
			k = k - 1
			j = j + 1
			if j == m + 1:
				j = 1
				i = i + c
		print(m2, m1, m3)
	elif k == n * m:
		print(1, 1, 1)
	elif x <= k // m:
		print(1, 0, 1)
	elif x == k // m + 1 and y <= k % m:
		print(1, 0, 1)
	else:
		print(1, 0, 0)
elif n == 2:
	m2 = k // (n * m)
	m3 = m2
	m1 = m2
	k = k % (n * m)
	if k > 0:
		m2 = m2 + 1
	i = 1
	j = 1
	while k > 0:
		if x == i and y == j:
			m3 = m3 + 1
		j = j + 1
		if j == m + 1:
			j = 1
			i = i + 1
		k = k - 1
	print(m2, m1, m3)
elif k % m == 0:
	print(k // m, k // m, k // m)
elif y <= k % m:
	print(k // m + 1, k // m, k // m + 1)
else:
	print(k // m + 1, k // m, k // m)


(n, m, k, x, y) = map(int, input().split())
if n != 1:
	oh = 2 * n * m - 2 * m
else:
	oh = m
gar_pls = k // oh
k %= oh
Q = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
	for j in range(1, m + 1):
		if n > i > 1:
			Q[i][j] = gar_pls * 2
		else:
			Q[i][j] = gar_pls
		if k:
			Q[i][j] += 1
			k -= 1
for i in range(n - 1, 1, -1):
	for j in range(1, m + 1):
		if k:
			Q[i][j] += 1
			k -= 1
mn = 10 ** 40
mx = -10 ** 40
serega = Q[x][y]
for i in Q[1:]:
	for j in i[1:]:
		mn = min(mn, j)
		mx = max(mx, j)
print(mx, mn, serega)


from math import *

def ri():
	return map(int, input().split())
(n, m, k, sr, sc) = ri()
if n == 1:
	t = k // m
else:
	t = k // (n * m + (n - 2) * m)
F = [[0] * (m + 1) for i in range(n + 1)]
for rr in range(1, n + 1):
	for cc in range(1, m + 1):
		if n == 1:
			F[rr][cc] = t
			continue
		if rr == 1 or rr == n:
			F[rr][cc] = t
		else:
			F[rr][cc] = t * 2
if n == 1:
	count = k % m
else:
	count = k % (n * m + (n - 2) * m)
for rr in range(1, n + 1):
	for cc in range(1, m + 1):
		if count == 0:
			break
		F[rr][cc] += 1
		count -= 1
	if count == 0:
		break
if count:
	for rr in range(n - 1, 1, -1):
		for cc in range(1, m + 1):
			if count == 0:
				break
			F[rr][cc] += 1
			count -= 1
		if count == 0:
			break
if n == 1:
	print(F[1][1], F[n][m], F[sr][sc])
else:
	print(max(F[1][1], F[2][1], F[n - 1][1]), F[n][m], F[sr][sc])


(n, m, k, x1, y1) = map(int, input().split())
c = 0
if n == 1:
	mi = k // m
	ma = mi + 1 * int(k % m != 0)
	s = mi + 1 * int(k % m > y1 - 1)
else:
	c = k // (m * (2 * n - 2))
	d = k % (m * (2 * n - 2))
	q = [[0 for i in range(m)] for j in range(n)]
	for i in range(n):
		for j in range(m):
			if 0 < i < n - 1:
				q[i][j] = 2 * c
			else:
				q[i][j] = c
	i = 0
	while d > 0:
		if i % (2 * n - 2) > n - 1:
			x = 2 * n - 2 - i % (2 * n - 2)
		else:
			x = i % (2 * n - 2)
		j = 0
		while d > 0 and j < m:
			q[x][j] += 1
			d -= 1
			j += 1
		i += 1
	ma = -1
	mi = 10 ** 100
	for i in range(n):
		for j in range(m):
			mi = min(q[i][j], mi)
			ma = max(q[i][j], ma)
	s = q[x1 - 1][y1 - 1]
print(ma, mi, s)


(n, m, k, x, y) = map(int, input().split())

def cnt(r, c):
	a = k
	if n == 1:
		return a // m + (a % m >= c)
	res = a // ((2 * n - 2) * m)
	if r != 1 and r != n:
		res *= 2
	a %= (2 * n - 2) * m
	if a > n * m:
		return res + 1 + (1 if r != n and a - n * m >= (n - r - 1) * m + c else 0)
	else:
		return res + (1 if a >= (r - 1) * m + c else 0)
r1 = cnt(1, 1)
r2 = cnt(2, 1)
r3 = cnt(n - 1, 1)
r4 = cnt(n, m)
r5 = cnt(x, y)
print(max(r1, r2, r3), r4, r5)


(n, m) = (0, 0)

def one_row(k, y):
	mi = s = ma = k // m
	if k % m > 0:
		ma += 1
	if y - 1 < k % m:
		s += 1
	return (mi, s, ma)
(n, m, k, x, y) = map(int, input().split())
if n == 1:
	(mi, s, ma) = one_row(k, y)
else:
	r = [0 for _ in range(n)]
	i = 0
	while i < n:
		if k < m:
			break
		k -= m
		r[i] += 1
		i += 1
	last_row_filled = i
	fills = k // ((n - 1) * m)
	ef = fills // 2
	of = fills - ef
	r[0] += of
	r[-1] += ef
	for i in range(1, n - 1):
		r[i] += fills
	k = k % ((n - 1) * m)
	if of != ef:
		i = 1
	else:
		i = n - 2
	if last_row_filled == n or fills:
		last_row_filled = i
	while k >= m:
		r[i] += 1
		if of != ef:
			i += 1
		else:
			i -= 1
		last_row_filled = i
		k -= m
	(mi, s, ma) = one_row(k, y)
	if x - 1 != last_row_filled:
		s = r[x - 1]
	else:
		s += r[x - 1]
	mi = min(mi + r[last_row_filled], min(r))
	ma = max(ma + r[last_row_filled], max(r))
print(ma, mi, s)


(n, m, k, y, x) = map(int, input().split())
maxnum = 0
minnum = 0
sergei = 0
if n == 1:
	maxnum = k // m + (1 if k % m > 0 else 0)
	minnum = k // m
	sergei = maxnum if x <= k % m else minnum
elif n == 2:
	maxnum = k // (m * 2) + (1 if k % (m * 2) > 0 else 0)
	minnum = k // (m * 2)
	sergei = maxnum if m * (y - 1) + x <= k % (m * 2) else minnum
else:
	z = (n * 2 - 2) * m
	a = k // z
	b = k % z
	maxnum = a * 2 + (1 if b > n * m else 0)
	maxnum += 1 if a == 0 and b > 0 else 0
	maxnum += 1 if a > 0 and b > m else 0
	minnum = a + (1 if b >= n * m else 0)
	if y == 1:
		sergei = a + (1 if x <= b else 0)
	elif y == n:
		sergei = a + (1 if x + (n - 1) * m <= b else 0)
	else:
		sergei = a * 2
		sergei += 1 if x + (y - 1) * m <= b else 0
		sergei += 1 if x + (n * 2 - 1 - y) * m <= b else 0
print(maxnum, minnum, sergei)


(n, m, k, x, y) = map(int, input().split())

def f(x, y):
	if n == 1:
		return k // m + (k % m >= y)
	period = m * n + m * (n - 2)
	amount_of_full_period = k // period
	remaining = k % period
	index = m * (x - 1) + y
	if x == 1 or x == n:
		return amount_of_full_period + (index <= remaining)
	return 2 * amount_of_full_period + (index <= remaining) + (m * n + (n - x - 1) * m + y <= remaining)
print(max(f(1, 1), f(2, 1), f(n - 1, 1)), f(n, m), f(x, y))