Jzzhu has a big rectangular chocolate bar that consists of n × m unit squares. He wants to cut this bar exactly k times. Each cut must meet the following requirements:

  each cut should be straight (horizontal or vertical);  each cut should go along edges of unit squares (it is prohibited to divide any unit chocolate square with cut);  each cut should go inside the whole chocolate bar, and all cuts must be distinct. 

The picture below shows a possible way to cut a 5 × 6 chocolate for 5 times.

 [Image] 

Imagine Jzzhu have made k cuts and the big chocolate is splitted into several pieces. Consider the smallest (by area) piece of the chocolate, Jzzhu wants this piece to be as large as possible. What is the maximum possible area of smallest piece he can get with exactly k cuts? The area of a chocolate piece is the number of unit squares in it.


-----Input-----

A single line contains three integers n, m, k (1 ≤ n, m ≤ 10^9; 1 ≤ k ≤ 2·10^9).


-----Output-----

Output a single integer representing the answer. If it is impossible to cut the big chocolate k times, print -1.


-----Examples-----
Input
3 4 1

Output
6

Input
6 4 2

Output
8

Input
2 3 4

Output
-1



-----Note-----

In the first sample, Jzzhu can cut the chocolate following the picture below:

 [Image] 

In the second sample the optimal division looks like this:

 [Image] 

In the third sample, it's impossible to cut a 2 × 3 chocolate 4 times.

Difficulty: competition

Starter code:

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

if k+2>n+m:
    print(-1)
else:
    if k >= n:
        alpha = m // (k-n+2)
    else:
        alpha = m * (n // (k+1))
    if k >= m:
        beta = n // (k-m+2)
    else:
        beta = n * (m // (k + 1))
    print(max(alpha, beta))


n, m, k = map(int, input().split())
if m > n:
	n, m = m, n
ans = -1
if k < n:
	ans = m * (n // (k + 1))
	if k < m:
		ans = max(ans, n * (m // (k + 1)))
elif k <= (n - 1) + (m - 1):
	ans = m // ((k + 1 - n) + 1)
print(ans)

"""
Codeforces Round 257 Div 1 Problem A

Author  : chaotic_iak
Language: Python 3.3.4
"""

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0:
        return inputs
    if mode == 1:
        return inputs.split()
    if mode == 2:
        return [int(x) for x in inputs.split()]

def write(s="\n"):
    if isinstance(s, list): s = " ".join(map(str,s))
    s = str(s)
    print(s, end="")

################################################### SOLUTION
n,m,k = read()

if n+m-2 < k:
    print(-1)
else:
    mx = 0
    if n > k:
        mx = max(mx, (n//(k+1)) * m)
    else:
        mx = max(mx, 1 * (m // (k-n+2)))
    if m > k:
        mx = max(mx, (m//(k+1)) * n)
    else:
        mx = max(mx, 1 * (n // (k-m+2)))
    print(mx)

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

if k <= n + m - 2:
    x = min(k + 1, n)
    y = k + 2 - x
    a = (n // x) * (m // y)
    y = min(k + 1, m)
    x = k + 2 - y
    b = (n // x) * (m // y)
    print(max(a, b))
else:
    print(-1)

n, m, k=list(map(int,input().split()))
if  n+m-2<k:
    print("-1\n")
else:
    x=min(n-1,k)
    y=max(0,k-x)
    ans=(n//(x+1))*(m//(y+1))
    y=min(m-1,k)
    x=max(0,k-y)
    ans=max(ans,(n//(x+1))*(m//(y+1)))
    print(ans,'\n')


from sys import stdin as cin
from fractions import gcd
mod = 1000000007
n, m, k = map(int,cin.readline().split())

if k>(n+m-2):
    print(-1)

else:
    if n < m:
        n,m = m,n
    max_min_area = max((n*(m//(k+1))),(m*(n//(k+1))))
    if (k+1) > m:
        max_min_area = max(max_min_area,n//(k-m+2))
    if (k+1) > n:
        max_min_area = max(max_min_area,m//(k-n+2))
    print(max_min_area)

def split1(m,n,k):
  if m%(k+1) == 0:
   return n*(m//(k+1))
  if k < m:
    return (m//(k+1))*n
  else:
    k2 = k - m + 1
    return n // (k2+1)

def split(m,n,k):
  r =  max(split1(m,n,k), split1(n,m,k))
  return r if r else -1

args = input().split()
print(split(*list(map(int, args))))
#assert split(2,3,4) == 0
#assert split(6,4,5) == 4
#assert split(98283,999283848,23) == 4092192268041
#assert split(6,4,6) == 2


def split1(m,n,k):
  if k < m:
    return (m//(k+1))*n
  else:
    return n // (k-m+2)

def split(m,n,k):
  r =  max(split1(m,n,k), split1(n,m,k))
  return r if r else -1

args = input().split()
print(split(*list(map(int, args))))
#assert split(2,3,4) == 0
#assert split(6,4,5) == 4
#assert split(98283,999283848,23) == 4092192268041
#assert split(6,4,6) == 2


n,m,k = list(map(int,input().split()))
ans = -1
if n>=k+1:
    ans = max(ans,n//(k+1)*m)
elif m>=k-n+2:
    ans=max(ans,m//(k-n+2))

n,m = m,n

if n>=k+1:
    ans = max(ans,n//(k+1)*m)
elif m>=k-n+2:
    ans=max(ans,m//(k-n+2))

print(ans)


n, m, k = map(int, input().split())
if k > n + m - 2: print(-1)
else:
    a, b = m * (n // (k + 1)), n * (m // (k + 1))
    if a == 0: a = m // (k - n + 2)
    if b == 0: b = n // (k - m + 2)
    print(max(a, b))

n, m, k = map(int, input().split())
n, m = min(n, m), max(n, m)
def p(i, j):
    return (n // (i + 1)) * (m // (j + 1))

if k < n:
    print(max(p(k, 0), p(0, k)))
elif k < m:
    print(p(0, k))
elif k <= n + m - 2:
    print(p(k - (m - 1), m - 1))
else:
    print(-1)

def main():
    a, b, c = list(map(int, input().split()))
    res, c = [-1], c + 1
    if c < a + b:
        for n, m, k in (a, b, c), (b, a, c):
            if n < k:
                k -= n - 1
                n, m = m, 1
            res.append(n // k * m)
    print(max(res))


def __starting_point():
    main()

__starting_point()

# Python is the best

def Calc(n, m, k):
    if n + m - 2 < k:
        return -1
    if k <= n - 1:
        return n // (k + 1) * m
    return m // (k - n + 2)


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

print(max(Calc(n, m, k), Calc(m, n, k)))


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

if m > n:

	n, m = m, n

ans = -1

if k < n:

	ans = m * (n // (k + 1))

	if k < m:

		ans = max(ans, n * (m // (k + 1)))

elif k <= (n - 1) + (m - 1):

	ans = m // ((k + 1 - n) + 1)

print(ans)



# Made By Mostafa_Khaled


l = input().split()
n = int(l[0])
m = int(l[1])
k = int(l[2])

if ( k <= n+m-2 ):
    if ( k < n ):
        outn = int((n / (k + 1))) * m
    else:
        outn = int(m / (k - n + 2))
    if ( k < m):
        outm = int( m / ( k + 1)) * n
    else:
        outm = int( n / ( k - m + 2 ))
    print ("", max( outn, outm), sep = '')
else:
    print ( "-1")

import math
n,m,k=list(map(int,input().split()))
if k>n+m-2 :
    print(-1)
    return
if n%(k+1)==0 :
    print(int(n/(k+1))*m)
    return
if m%(k+1)==0 :
    print(int(m/(k+1))*n)
    return
r=max(n//(k+1),1)
r1=max(0,k-n+1)
r2=m//(1+r1)
ans=r*r2
r=max(m//(k+1),1)
r1=max(0,k-m+1)
r2=n//(1+r1)
ans=max(ans,r*r2)
print(int(ans))
        
    


n, m, k = map(int, input().split())
 
if k <= n + m - 2:
    x = min(k + 1, n)
    y = k + 2 - x
    a = (n // x) * (m // y)
    y = min(k + 1, m)
    x = k + 2 - y
    b = (n // x) * (m // y)
    print(max(a, b))
else:
    print(-1)

n,m,k=[int(s) for s in input().split()]
n,m=max(n,m),min(n,m)
if n+m-2<k:print(-1)
elif n-1<k:
    print(m//(k-n+2))
elif m-1<k:print(n//(k+1)*m)
else:
    print(max(n//(k+1)*m,m//(k+1)*n))


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

if n + m - 2 < k:
	print(-1)
	return

def divisors(n):
	div = set()

	for i in range(1, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			div.add(i)
			div.add(n // i)

	return [*div]

def solve(n, m, k):
	div = divisors(n)
	ans = 0

	for i in div:
		if i - 1 > k: continue
		ans = max(ans, (n // i) * (m // (k - i + 2)))

	return ans

print(max(solve(n, m, k), solve(m, n, k)))

a,b,k = list(map(int,input().split()))
if a+b-2<k:
	print(-1)
	return
k+=2
if a>b:
	a,b=b,a

i = 1
maxi = -1
while (i*i<=a):

	y=min(i,k-1)
	val1 = (a//y)*(b//(k-y))
	if maxi<val1:
		maxi = val1

	j = min(a//i,k-1)
	val2 = (a//j)*(b//(k-j))
	if maxi<val2:
		maxi=val2
	i+=1
print(maxi)


n,m,k = list(map(int,input().split()))
ans,ans1=0,0
if n+m-2<k:
    print(-1)
    return
else:
    k1=k
    if k<n:
        ans=(n//(k+1))*m
    else:
        k-=(n-1)
        ans = (m//(k+1))
    if k1<m:
        ans1 = (m//(k1+1))*n
    else:
        k1-=(m-1)
        ans1 = (n//(k1+1))
print(max(ans1,ans))