#include <bits/stdc++.h>
unsigned long long ax, ay, bx, by;
unsigned long long xs, ys, t;
unsigned long long nox[205], noy[205];
int n;
unsigned long long dis[205][205];
unsigned long long sdis[205];
unsigned long long calc(unsigned long long xa, unsigned long long ya,
                        unsigned long long xb, unsigned long long yb) {
  return (xb >= xa ? xb - xa : xa - xb) + (yb >= ya ? yb - ya : ya - yb);
}
int main() {
  scanf("%llu%llu%llu%llu%llu%llu%llu%llu%llu", &nox[0], &noy[0], &ax, &ay, &bx,
        &by, &xs, &ys, &t);
  for (int i = 1; nox[i - 1] <= 1e17 && noy[i - 1] <= 1e17; ++i) {
    nox[i] = ax * nox[i - 1] + bx;
    noy[i] = ay * noy[i - 1] + by;
    n = i;
  }
  for (int i = 0; i <= n; ++i) {
    sdis[i] = calc(xs, ys, nox[i], noy[i]);
    for (int j = 0; j <= n; ++j)
      dis[i][j] = calc(nox[i], noy[i], nox[j], noy[j]);
  }
  int ans = 0;
  for (int i = 0; i <= n; ++i)
    for (int l = 0; l <= i; ++l)
      for (int r = i; r <= n; ++r)
        if (t >=
            sdis[i] + dis[l][i] + dis[r][i] + std::min(dis[l][i], dis[r][i]))
          ans = std::max(ans, r - l + 1);
  printf("%d", ans);
  return 0;
}
