#include <bits/stdc++.h>usingnamespacestd;
#define N 1000000007longlong x[100];
int main()
{
longlong a, b, ans, c;
cin >> x[1] >> x[2] >> ans;
x[3] = x[2] - x[1];
c = ans / 3;
if (c % 2 == 0)
{
c = ans % 3;
if (c == 0)
{
ans = -x[3];
}
if (c == 1)
{
ans = x[1];
}
if (c == 2)
{
ans = x[2];
}
}
else
{
c = ans % 3;
if (c == 0)
{
ans = x[3];
}
if (c == 1)
{
ans = -x[1];
}
if (c == 2)
{
ans = -x[2];
}
}
while (ans < 0)
ans += N;
cout << ans % N;
return0;
}
#include <bits/stdc++.h>usingnamespacestd;
int main()
{
longlong n, m, k;
cin >> n >> m >> k;
if (n < m)
swap(n, m);
if (k > n - 1 + m - 1)
cout << -1;
else
{
if (k <= m - 1)
{
longlong ans = 1, s1, s2, max6;
ans = n / (k + 1);
s1 = ans * m;
ans = m / (k + 1);
s2 = ans * n;
max6 = max(s1, s2);
cout << max6;
}
elseif (k <= n - 1)
{
longlong ans = 1, s1;
ans = n / (k + 1);
s1 = ans * m;
cout << s1;
}
else
{
k = k - n + 1;
longlong ans = 1;
ans = m / (k + 1);
cout << (ans);
}
}
return0;
}