#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long INF = 1ll << 60;
const double Inf = 1e20;
const double eps = 1e-9;
void gmax(int &a, int b) { a = (a > b ? a : b); }
void gmin(int &a, int b) { a = (a < b ? a : b); }
long long n, m, k, ans, a;
const int p = 1e9 + 7;
int main() {
  cin >> n >> m >> k;
  if (n > m) swap(n, m);
  if ((m - n) % 2ll != 0 && k == -1) return 0 * printf("0\n");
  --n;
  ans = 1;
  a = 2;
  while (n) {
    if (n & 1) ans = (ans * a) % p;
    n >>= 1;
    a = (a * a) % p;
  }
  --m;
  a = ans;
  ans = 1;
  while (m) {
    if (m & 1) ans = (ans * a) % p;
    m >>= 1;
    a = (a * a) % p;
  }
  cout << ans << endl;
  return 0;
}
