#include <bits/stdc++.h>
std::vector<std::pair<long long, long long> > A;
long long dist(std::pair<long long, long long> a,
               std::pair<long long, long long> b) {
  return std::abs((long long)(a.first - b.first)) +
         std::abs((long long)(a.second - b.second));
}
int main(void) {
  long long x_, y_, ax_, ay_, bx_, by_, xs_, ys_, t_;
  while (scanf("%lld %lld %lld %lld %lld %lld %lld %lld %lld", &x_, &y_, &ax_,
               &ay_, &bx_, &by_, &xs_, &ys_, &t_) >= 9) {
    long long x = x_, y = y_, ax = ax_, ay = ay_, bx = bx_, by = by_, xs = xs_,
              ys = ys_, t = t_;
    long long cx = x, cy = y;
    A.clear();
    while (std::max(cx - xs, (long long)0) + std::max(cy - ys, (long long)0) <=
           t) {
      if (dist({cx, cy}, {xs, ys}) <= t) A.push_back({cx, cy});
      cx = ax * cx + bx;
      cy = ay * cy + by;
    }
    int best = 0;
    for (int i = 0; i < (int)A.size(); ++i) {
      long long cur_t = dist({xs, ys}, A[i]);
      if (cur_t > t) break;
      best = std::max(best, 1);
      long long u_t = 0;
      for (int j = i - 1; j >= 0; --j) {
        u_t += dist(A[j], A[j + 1]);
        if (cur_t + u_t <= t) {
          best = std::max(best, 1 + (i - j));
          long long v_t = dist(A[j], A[i + 1]);
          for (int k = i + 1; k < (int)A.size(); ++k) {
            if (cur_t + u_t + v_t <= t) {
              best = std::max(best, 1 + (i - j) + (k - i));
            } else
              break;
            if (k + 1 < (int)A.size()) {
              v_t += dist(A[k], A[k + 1]);
            } else
              break;
          }
        } else
          break;
      }
      long long v_t = 0;
      for (int j = i + 1; j < (int)A.size(); ++j) {
        v_t += dist(A[j - 1], A[j]);
        if (cur_t + v_t <= t) {
          best = std::max(best, 1 + (j - i));
        }
      }
    }
    printf("%d\n", best);
  }
  return 0;
}
