#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;
int multiply(long long a, long long b) {
  return (long long)((a % MOD) * (b % MOD)) % MOD;
}
int mpow(long long a, long long b) {
  int ret = 1;
  while (b) {
    if (b & 1) {
      ret = multiply(ret, a);
    }
    a = multiply(a, a);
    b >>= 1;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  int k;
  cin >> n >> m >> k;
  if (k == -1 && n % 2 != m % 2)
    cout << 0 << '\n';
  else
    cout << mpow(mpow(2, (n - 1)), (m - 1)) << '\n';
  return 0;
}
