#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using int64 = long long int;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
int main() {
  ll x0, y0, a, b, c, d;
  cin >> x0 >> y0 >> a >> c >> b >> d;
  ll xs, ys, t;
  cin >> xs >> ys >> t;
  const ll MAX_C = 1LL * 10000 * 10000 * 10000 * 10000;
  vector<ll> x, y;
  {
    ll xc = x0, yc = y0;
    while (xc <= MAX_C and yc <= MAX_C) {
      x.emplace_back(xc);
      y.emplace_back(yc);
      xc = a * xc + b;
      yc = c * yc + d;
    }
    x.emplace_back(xc);
    y.emplace_back(yc);
  }
  int ans = 0;
  for (int ini = 0; ini < (int)x.size(); ini++) {
    ll cost = abs(xs - x[ini]) + abs(ys - y[ini]);
    if (cost <= t) chmax(ans, 1);
    {
      ll sum = cost;
      for (int ub = ini + 1; ub < (int)x.size(); ub++) {
        sum += abs(x[ub] - x[ub - 1]) + abs(y[ub] - y[ub - 1]);
        if (sum <= t)
          chmax(ans, ub - ini + 1);
        else
          break;
      }
    }
    {
      ll sum = cost;
      for (int lb = ini - 1; lb >= 0; lb--) {
        sum += abs(x[lb] - x[lb + 1]) + abs(y[lb] - y[lb + 1]);
        if (sum <= t)
          chmax(ans, ini - lb + 1);
        else
          break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
