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