#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
const int MX = 1e5;
ll ax, bx;
ll ay, by;
ll xs, ys;
ll t;
int N;
ll x[MX + 2];
ll y[MX + 2];
ll dist(ll x1, ll y1, ll x2 = xs, ll y2 = ys) {
  ll dx = x1 - x2;
  ll dy = y1 - y2;
  if (dx < 0) dx = -dx;
  if (dy < 0) dy = -dy;
  return dx + dy;
}
void genera_tabla(ll x0, ll y0) {
  while (x0 - xs <= t && y0 - ys <= t) {
    x[N] = x0;
    y[N] = y0;
    N++;
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll x0, y0;
  cin >> x0 >> y0;
  cin >> ax >> ay;
  cin >> bx >> by;
  cin >> xs >> ys;
  cin >> t;
  genera_tabla(x0, y0);
  int mejor = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      ll aux = dist(x[i], y[i]);
      for (int k = i; k < j + 1; ++k) {
        ll temp =
            min(dist(x[k], y[k], x[i], y[i]), dist(x[k], y[k], x[j], y[j]));
        temp += dist(x[k], y[k]);
        aux = min(aux, temp);
      }
      for (int k = i; k < j; ++k) aux += dist(x[k], y[k], x[k + 1], y[k + 1]);
      if (aux <= t) {
        mejor = max(mejor, j - i + 1);
      }
    }
  }
  cout << mejor << '\n';
  return 0;
}
