#include #include using namespace std; using namespace atcoder; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; //using mint = modint1000000007; //using mint = modint998244353; char f[1005][1005]; bool check(ll H, ll W, ll X, bool flip){ rep(i,H) rep(j,W) f[i][j] = '.'; for(int i=1; i mx || (X-mn)%4!=0){ return false; } ll cnt = (mx-X)/4; vector v; for(int i=3; i 0){ v[p]++; p++; if(p>=v.size()) p=0; cnt--; } for(int i=3; i mx || (X-mn)%4!=0){ return false; } ll cnt = (mx-X)/4; vector v; for(int i=3; i 0){ v[p]++; p++; if(p>=v.size()) p=0; cnt--; } for(int i=3; i> H >> W >> X; if(check(H, W, X, false)) return 0; if(check(W, H, X, true)) return 0; cout << -1 << endl; return 0; }