#include <bits/stdc++.h>
template <typename T>
inline int chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline T abs(const T &x) {
  return x < 0 ? -x : x;
}
using namespace std;
const int MAXN = 100, MAXM = 100000;
int n;
long long a[2], b[2], sx, sy, t;
long long x[MAXN + 9], y[MAXN + 9];
void Generate() {
  while (x[n] <= sx + t && y[n] <= sy + t) {
    x[n + 1] = a[0] * x[n] + b[0], y[n + 1] = a[1] * y[n] + b[1];
    ++n;
  }
}
int Work() {
  int res = 0;
  for (int i = 0; i <= n; ++i) {
    long long Nextx = sx, Nexty = sy, T = t;
    int Ans = 0;
    for (int j = i; ~j; --j) {
      long long NextT = abs(x[j] - Nextx) + abs(y[j] - Nexty);
      if (NextT <= T) T -= NextT, ++Ans, Nextx = x[j], Nexty = y[j];
    }
    for (int j = i + 1; j <= n; ++j) {
      long long NextT = abs(x[j] - Nextx) + abs(y[j] - Nexty);
      if (NextT <= T) T -= NextT, ++Ans, Nextx = x[j], Nexty = y[j];
    }
    chkmax(res, Ans);
    Nextx = sx;
    Nexty = sy;
    T = t;
    Ans = 0;
    for (int j = i + 1; j <= n; ++j) {
      long long NextT = abs(x[j] - Nextx) + abs(y[j] - Nexty);
      if (NextT <= T) T -= NextT, ++Ans, Nextx = x[j], Nexty = y[j];
    }
    for (int j = i; ~j; --j) {
      long long NextT = abs(x[j] - Nextx) + abs(y[j] - Nexty);
      if (NextT <= T) T -= NextT, ++Ans, Nextx = x[j], Nexty = y[j];
    }
    chkmax(res, Ans);
  }
  return res;
}
int main() {
  cin >> x[0] >> y[0] >> a[0] >> a[1] >> b[0] >> b[1];
  cin >> sx >> sy >> t;
  Generate();
  int Ans = 0;
  for (int i = 1; i <= n; ++i)
    if (abs(sx - x[i]) + abs(sy - y[i]) <= t) Ans = 1;
  chkmax(Ans, Work());
  cout << Ans << '\n';
  return 0;
}
