description: Mr. Chanek wants to knit a batik, a traditional cloth from Indonesia. The cloth forms a grid a with size n × m. There are k colors, and each cell in the grid can be one of the k colors.
  
  Define a sub-rectangle as an ordered pair of two cells ((x_1, y_1), (x_2, y_2)), denoting the top-left cell and bottom-right cell (inclusively) of a sub-rectangle in a. Two sub-rectangles ((x_1, y_1), (x_2, y_2)) and ((x_3, y_3), (x_4, y_4)) have the same pattern if and only if the following holds: 
  
    * they have the same width (x_2 - x_1 = x_4 - x_3); 
    * they have the same height (y_2 - y_1 = y_4 - y_3); 
    * for every pair (i, j) where 0 ≤ i ≤ x_2 - x_1 and 0 ≤ j ≤ y_2 - y_1, the color of cells (x_1 + i, y_1 + j) and (x_3 + i, y_3 + j) are equal. 
  
  
  
  Count the number of possible batik color combinations, such that the subrectangles ((a_x, a_y),(a_x + r - 1, a_y + c - 1)) and ((b_x, b_y),(b_x + r - 1, b_y + c - 1)) have the same pattern.
  
  Output the answer modulo 10^9 + 7.
  
  Input
  
  The first line contains five integers n, m, k, r, and c (1 ≤ n, m ≤ 10^9, 1 ≤ k ≤ 10^9, 1 ≤ r ≤ min(10^6, n), 1 ≤ c ≤ min(10^6, m)) — the size of the batik, the number of colors, and size of the sub-rectangle.
  
  The second line contains four integers a_x, a_y, b_x, and b_y (1 ≤ a_x, b_x ≤ n, 1 ≤ a_y, b_y ≤ m) — the top-left corners of the first and second sub-rectangle. Both of the sub-rectangles given are inside the grid (1 ≤ a_x + r - 1, b_x + r - 1 ≤ n, 1 ≤ a_y + c - 1, b_y + c - 1 ≤ m).
  
  Output
  
  Output an integer denoting the number of possible batik color combinations modulo 10^9 + 7.
  
  Examples
  
  Input
  
  
  3 3 2 2 2
  1 1 2 2
  
  
  Output
  
  
  32
  
  
  Input
  
  
  4 5 170845 2 2
  1 4 3 1
  
  
  Output
  
  
  756680455
  
  Note
  
  The following are all 32 possible color combinations in the first example.
  
  <image>
solution: #include <bits/stdc++.h>
  #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
  using namespace std;
  template <class T>
  using rque = priority_queue<T, vector<T>, greater<T>>;
  template <class T>
  bool chmin(T &a, const T &b) {
    if (b < a) {
      a = b;
      return 1;
    }
    return 0;
  }
  template <class T>
  bool chmax(T &a, const T &b) {
    if (b > a) {
      a = b;
      return 1;
    }
    return 0;
  }
  long long gcd(long long a, long long b) {
    if (a == 0) return b;
    if (b == 0) return a;
    long long cnt = a % b;
    while (cnt != 0) {
      a = b;
      b = cnt;
      cnt = a % b;
    }
    return b;
  }
  long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
      x = 1;
      y = 0;
      return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
  }
  struct UnionFind {
    vector<long long> data;
    int num;
    UnionFind(int sz) {
      data.assign(sz, -1);
      num = sz;
    }
    bool unite(int x, int y) {
      x = find(x), y = find(y);
      if (x == y) return (false);
      if (data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
      num--;
      return (true);
    }
    int find(int k) {
      if (data[k] < 0) return (k);
      return (data[k] = find(data[k]));
    }
    long long size(int k) { return (-data[find(k)]); }
    bool same(int x, int y) { return find(x) == find(y); }
  };
  template <int mod>
  struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {
      if ((x += p.x) >= mod) x -= mod;
      return *this;
    }
    ModInt &operator-=(const ModInt &p) {
      if ((x += mod - p.x) >= mod) x -= mod;
      return *this;
    }
    ModInt &operator*=(const ModInt &p) {
      x = (int)(1LL * x * p.x % mod);
      return *this;
    }
    ModInt &operator/=(const ModInt &p) {
      *this *= p.inverse();
      return *this;
    }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt &operator++() { return *this += ModInt(1); }
    ModInt operator++(int) {
      ModInt tmp = *this;
      ++*this;
      return tmp;
    }
    ModInt &operator--() { return *this -= ModInt(1); }
    ModInt operator--(int) {
      ModInt tmp = *this;
      --*this;
      return tmp;
    }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
      int a = x, b = mod, u = 1, v = 0, t;
      while (b > 0) {
        t = a / b;
        swap(a -= t * b, b);
        swap(u -= t * v, v);
      }
      return ModInt(u);
    }
    ModInt pow(int64_t n) const {
      ModInt ret(1), mul(x);
      while (n > 0) {
        if (n & 1) ret *= mul;
        mul *= mul;
        n >>= 1;
      }
      return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
    friend istream &operator>>(istream &is, ModInt &a) {
      int64_t t;
      is >> t;
      a = ModInt<mod>(t);
      return (is);
    }
    static int get_mod() { return mod; }
  };
  long long mpow2(long long x, long long n, long long mod) {
    long long ans = 1;
    while (n != 0) {
      if (n & 1) ans = ans * x % mod;
      x = x * x % mod;
      n = n >> 1;
    }
    return ans;
  }
  long long modinv2(long long a, long long mod) {
    long long b = mod, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
  }
  constexpr int mod = 1000000007;
  using mint = ModInt<mod>;
  mint mpow(mint x, long long n) {
    mint ans = 1;
    while (n != 0) {
      if (n & 1) ans *= x;
      x *= x;
      n = n >> 1;
    }
    return ans;
  }
  long long k;
  mint solve(long long n, long long m, long long r, long long c) {
    if (n == r && m == c) return mpow(k, n * m);
    if (2 * r - n <= 0 || 2 * c - m <= 0) return mpow(k, n * m - r * c);
    return solve(r, c, 2 * r - n, 2 * c - m) * mpow(k, 2 * (n - r) * (m - c));
  }
  int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(15);
    long long n, m, r, c, ax, ay, bx, by;
    cin >> n >> m >> k >> r >> c >> ax >> ay >> bx >> by;
    if (ax > bx) {
      ax = n + 1 - ax;
      bx = n + 1 - bx;
    }
    if (ay > by) {
      ay = n + 1 - ay;
      by = n + 1 - by;
    }
    long long cn = bx + r - ax, cm = by + c - ay;
    mint ans = mpow(k, n * m - cn * cm);
    ans *= solve(cn, cm, r, c);
    cout << ans << endl;
  }
  