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