#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f;
const double pi = 3.1415926535897932384626;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int maxn = 1e6 + 5;
long long sx, sy, ax, ay, bx, by, t, cnt, x[maxn], y[maxn];
int main() {
  x[0] = read(), y[0] = read(), ax = read(), ay = read(), bx = read(),
  by = read();
  sx = read(), sy = read(), t = read();
  while (1) {
    long long xx = ax * x[cnt] + bx, yy = ay * y[cnt] + by;
    if (xx - sx > t || yy - sy > t) break;
    x[++cnt] = xx, y[cnt] = yy;
  }
  long long ans = 0;
  for (long long i = 0; i <= cnt; ++i) {
    for (long long j = 0; j <= cnt; ++j) {
      long long xx = abs(sx - x[i]) + abs(sy - y[i]);
      long long yy = abs(sx - x[j]) + abs(sy - y[j]);
      long long sum = min(xx, yy) + abs(x[i] - x[j]) + abs(y[i] - y[j]);
      if (sum <= t) ans = max(ans, j - i + 1);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
