#include <bits/stdc++.h>
using namespace std;
unsigned long long int md = 1000000007;
unsigned long long int power(unsigned long long int x,
                             unsigned long long int y) {
  unsigned long long int result = 1;
  while (y) {
    if (y & 1) {
      result *= x;
      result %= md;
    }
    y >>= 1;
    x *= x;
    x %= md;
  }
  return result;
}
int main() {
  unsigned long long int n, m, k;
  cin >> n >> m >> k;
  if (n == 1 && m == 2 && k == -1) {
    cout << 0 << endl;
    return 0;
  }
  if (n == 2 && m == 1 && k == -1) {
    cout << 0 << endl;
    return 0;
  }
  if (n % 2 == 1 && m % 2 == 0 && k == -1) {
    cout << 0 << endl;
    return 0;
  }
  if (n % 2 == 0 && m % 2 == 1 && k == -1) {
    cout << 0 << endl;
    return 0;
  }
  if (n == 1 || m == 1) {
    cout << power(2, (n - 1) * (m - 1)) << endl;
  } else {
    unsigned long long int q = power(2, (n - 1));
    q %= md;
    q = q * (power(2, (m - 1) % md));
    if (n == 2 || m == 2) q /= 2;
    q %= md;
    cout << power(power(2, (n - 1)) % md, m - 1) % md << endl;
  }
  return 0;
}
