#include <bits/stdc++.h>
using namespace std;
long long x[80], y[80], ax, ay, bx, by, sx, sy, t, cx, cy, ans = 0;
inline long long read() {
  long long red = 0, f_f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f_f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') red = red * 10 + ch - '0', ch = getchar();
  return red * f_f;
}
signed main() {
  x[0] = read(), y[0] = read(), ax = read(), ay = read(), bx = read(),
  by = read(), sx = read(), sy = read(), t = read();
  for (cx = 1; x[cx - 1] <= 5e16; cx++) x[cx] = ax * x[cx - 1] + bx;
  for (cy = 1; y[cy - 1] <= 5e16; cy++) y[cy] = ay * y[cy - 1] + by;
  for (long long i = 0; i <= min(cx, cy) - 1; i++) {
    long long dt = abs(sx - x[i]) + abs(sy - y[i]);
    if (dt > t) continue;
    for (long long j = i - 1; ~j; j--) {
      dt += abs(x[j + 1] - x[j]) + abs(y[j + 1] - y[j]);
      if (dt > t) {
        ans = max(ans, i - j);
        break;
      }
    }
    if (dt > t) continue;
    long long pre = 0;
    for (long long j = i + 1;; j++) {
      dt += abs(x[j] - x[pre]) + abs(y[j] - y[pre]);
      if (dt > t) {
        ans = max(ans, j);
        break;
      }
      pre = j;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
