#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long quick_pow(long long a, long long b) {
  long long res = 1LL;
  while (b) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
int main() {
  long long n, m;
  int k;
  cin >> n >> m >> k;
  if ((n + m) & 1 && -1 == k)
    cout << 0 << endl;
  else if (1 == n)
    cout << 1 << endl;
  else {
    long long ans = quick_pow(quick_pow(2, n - 1), m - 1);
    cout << ans << endl;
  }
  return 0;
}
