#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x;
  char c;
  int f = 1;
  while ((c = getchar()) != '-' && (c < '0' || c > '9'))
    ;
  if (c == '-') c = getchar(), f = -1;
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ '0');
  return x * f;
}
inline long long readll() {
  long long x;
  char c;
  long long f = 1;
  while ((c = getchar()) != '-' && (c < '0' || c > '9'))
    ;
  if (c == '-') c = getchar(), f = -1;
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1ll) + (x << 3ll) + (c ^ '0');
  return x * f;
}
const long long mod = 1e9 + 7;
long long ksm(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1ll) ans = ans * x % mod;
    y >>= 1ll;
    x = x * x % mod;
  }
  return ans;
}
int main() {
  long long n = readll(), m = readll();
  if (m < n) swap(n, m);
  int k = read();
  if ((n & 1ll) ^ (m & 1ll) && k == -1) {
    printf("0\n");
    return 0;
  }
  n = (n - 1) % (mod - 1);
  m = (m - 1) % (mod - 1);
  printf("%lld\n", ksm(2, n * m % (mod - 1)));
  return 0;
}
