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