#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, k, sol = 1, p = 0, ant, t = 2, s;
  cin >> n >> m >> k;
  if (k == -1 && n % 2 != m % 2)
    cout << 0;
  else if (n == 1 || m == 1)
    cout << 1;
  else {
    s = 2;
    while (n != 1) {
      p = 0;
      t = s;
      while (p <= n - 1) {
        ant = sol;
        sol *= t;
        sol %= 1000000007;
        if (p != 0) t *= t;
        t %= 1000000007;
        if (p == 0)
          p++;
        else
          p *= 2;
      }
      p /= 2;
      sol = ant;
      n -= p;
    }
    s = sol;
    sol = 1;
    while (m != 1) {
      p = 0;
      t = s;
      while (p <= m - 1) {
        ant = sol;
        sol *= t;
        sol %= 1000000007;
        if (p != 0) t *= t;
        t %= 1000000007;
        if (p == 0)
          p++;
        else
          p *= 2;
      }
      p /= 2;
      sol = ant;
      m -= p;
    }
    cout << sol;
  }
  return 0;
}
