#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> nodes;
long long d[64][64];
long long dp[64][64];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  memset(&d, '\0', sizeof(d));
  for (long long i = 0; i < 64; i++)
    for (long long j = 0; j < 64; j++) dp[i][j] = 1;
  bool cond1 = abs(x0 - xs) + abs(y0 - ys) <= t,
       cond2 = abs(x0 - xs) + abs(y0 - ys) >=
               abs(ax * x0 + bx - xs) + abs(ay * y0 + by - ys);
  while (cond1 || cond2) {
    if (abs(x0 - xs) + abs(y0 - ys) <= t) nodes.push_back({x0, y0});
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
    cond1 = abs(x0 - xs) + abs(y0 - ys) <= t;
    if (x0 > (long long)2e16 || y0 > (long long)2e16)
      cond2 = false;
    else
      cond2 = abs(x0 - xs) + abs(y0 - ys) >=
              abs(ax * x0 + bx - xs) + abs(ay * y0 + by - ys);
  }
  long long temp = nodes.size();
  for (long long i = 0; i < nodes.size(); i++)
    for (long long j = i + 1; j < nodes.size(); j++) {
      d[i][j] = d[j][i] = d[i][j - 1] +
                          abs(nodes[j - 1].first - nodes[j].first) +
                          abs(nodes[j - 1].second - nodes[j].second);
      dp[i][j] = dp[j][i] = j - i + 1;
    }
  long long ans = 0;
  for (long long i = 0; i < nodes.size(); i++) {
    long long cost = t - abs(xs - nodes[i].first) - abs(ys - nodes[i].second);
    for (long long j = 0; j <= i; j++)
      for (long long k = i; k < nodes.size(); k++)
        if (min(d[i][k], d[i][j]) + d[k][j] <= cost) ans = max(ans, dp[j][k]);
  }
  cout << ans << '\n';
  return 0;
}
