#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
long long m, n;
long long quick(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    y >>= 1;
    x = x * x % mod;
  }
  return ans;
}
int main() {
  int a;
  while (cin >> m >> n >> a) {
    if ((m + n) & 1 && a == -1) {
      puts("0");
      continue;
    }
    long long p = quick(quick(2, m - 1), n - 1);
    printf("%I64d\n", p);
  }
  return 0;
}
