#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
long long n, m;
int k;
long long expo(long long e, long long base) {
  if (e == 0) return 1ll;
  long long ans = expo(e / 2ll, base);
  ans = mod(ans * ans);
  if (e & 1ll) ans = mod(ans * base);
  return ans;
}
int main() {
  scanf("%lld %lld %d", &n, &m, &k);
  if (k == -1 && (n & 1) != (m & 1))
    printf("0\n");
  else
    printf("%lld\n", expo(n - 1, expo(m - 1, 2)));
}
