#include <bits/stdc++.h>
using namespace std;
long long xp, yp, ax, ay, bx, by, xs, ys, t, anss, cnt;
long long ptx[1010], pty[1010];
long long read() {
  long long r = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') r = (r << 1) + (r << 3) + c - '0', c = getchar();
  return r * f;
}
void put(long long x) {
  if (x < 0) {
    putchar('-');
    x = ~x + 1;
  }
  if (x > 9) put(x / 10);
  putchar(x % 10 + '0');
}
signed main() {
  xp = read(), yp = read(), ax = read(), ay = read(), bx = read(), by = read(),
  xs = read(), ys = read(), t = read();
  while (1) {
    if (llabs(xp - xs) + llabs(yp - ys) <= t || xp - xs + yp - ys > t) break;
    xp = xp * ax + bx, yp = yp * ay + by;
  }
  while (1) {
    if (llabs(xp - xs) + llabs(yp - ys) > t) break;
    ptx[++cnt] = xp, pty[cnt] = yp;
    xp = xp * ax + bx, yp = yp * ay + by;
  }
  for (long long i = 1; i <= cnt; i++) {
    long long ans = llabs(ptx[i] - xs) + llabs(pty[i] - ys), j = i, sum1 = 1,
              sum2 = 1;
    while (j > 1) {
      if (ans + ptx[j] - ptx[j - 1] + pty[j] - pty[j - 1] > t) break;
      ans += ptx[j] - ptx[j - 1] + pty[j] - pty[j - 1];
      j--, sum1++;
    }
    ans = llabs(ptx[i] - xs) + llabs(pty[i] - ys), j = i;
    while (j < cnt) {
      if (ans + ptx[j + 1] - ptx[j] + pty[j + 1] - pty[j] > t) break;
      ans += ptx[j + 1] - ptx[j] + pty[j + 1] - pty[j];
      j++, sum2++;
    }
    anss = max(anss, max(sum1, sum2));
  }
  put(anss);
  puts("");
  return 0;
}
