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

~/algor $ cat problems/qidiruv-diplomlar

A board for diplomas

Medium 1000 ms 128 MB 66%
Share

$n$ identical diplomas of width $w$ and height $h$ must be hung on a square board. The diplomas are not rotated (the width is horizontal), do not overlap and do not stick out of the board; they are laid out on the board in rows and columns. What is the smallest possible side of the board?

A square board: identical diplomas laid out in rows and columns, the side of the board highlighted

Input

One line with three positive integers: $w$, $h$ and $n$.

Output

One positive integer — the smallest side of the board.

Note

$1 \le w, h, n \le 10^{9}$

Examples

Input #1
2 3 10
Output #1
9
Input #2
1 1 1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.