#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1000000007;
long long int expo(long long int x, long long int y) {
  long long int ans = 1;
  while (y) {
    if (y & 1) ans = (ans * x) % MOD;
    y = y >> 1;
    x = (x * x) % MOD;
  }
  return ans;
}
int main(int argc, char const *argv[]) {
  long long int n, m, k;
  cin >> n >> m >> k;
  if (n == 1) {
    if (k == 1) {
      cout << 1;
      return 0;
    }
    if (k == -1 && m % 2 == 1) {
      cout << 1;
      return 0;
    }
    if (k == -1 && m % 2 == 0) {
      cout << 0;
      return 0;
    }
  }
  if (m == 1) {
    if (k == 1) {
      cout << 1;
      return 0;
    }
    if (k == -1 && n % 2 == 1) {
      cout << 1;
      return 0;
    }
    if (k == -1 && n % 2 == 0) {
      cout << 0;
      return 0;
    }
  }
  if (k == 1 || (k == -1 && (n % 2 == m % 2))) {
    long long int p = (n - 1) % (MOD - 1);
    long long int q = (m - 1) % (MOD - 1);
    long long int ans1 = (p * q) % (MOD - 1);
    long long int ans = (expo(2, ans1)) % MOD;
    cout << ans;
    return 0;
  } else {
    cout << 0;
    return 0;
  }
  return 0;
}
