Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/integer-xonadon-podyezdi-va-qavati

Entrance and floor of a flat

Medium 1000 ms 64 MB 41%
Share

Each entrance of an apartment building has $m$ floors, and each floor has $k$ flats. The flats are numbered consecutively starting from $1$: first the $k$ flats of floor $1$ of entrance $1$, then the flats of floor $2$, and so on; when an entrance ends, the numbering continues from floor $1$ of the next entrance. For example, with $m = 5$, $k = 4$, flats $1$–$20$ are in entrance $1$, and flat $21$ is on floor $1$ of entrance $2$. Find the entrance and the floor of flat $n$.

The position of a flat by the entrances and floors of the building

Input

One line with three positive integers: $m$, $k$ and $n$.

Output

One line with two positive integers: the entrance number $p$ and the floor number $q$.

Note

$1 \le m, k \le 1000$
$1 \le n \le 10^{9}$

Examples

Input #1
5 4 21
Output #1
2 1
Input #2
9 4 75
Output #2
3 1

Sign in to submit a solution

Signing up is free and takes a minute.