#include <bits/stdc++.h>
using namespace std;
auto main() -> int {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int64_t x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  int64_t x, y, t;
  cin >> x >> y >> t;
  vector<pair<int64_t, int64_t>> points{{x0, y0}};
  while (points.back().first <= x + t && points.back().second <= y + t) {
    int64_t new_x = points.back().first * ax + bx;
    int64_t new_y = points.back().second * ay + by;
    points.emplace_back(new_x, new_y);
  }
  using Point = pair<int64_t, int64_t>;
  auto dist = [](const Point &lhs, const Point &rhs) {
    return abs(lhs.first - rhs.first) + abs(lhs.second - rhs.second);
  };
  auto start = Point(x, y);
  int64_t best = 0;
  for (int i = 0; i < points.size(); ++i) {
    int64_t full = dist(points[i], start), count = 1;
    if (full > t) continue;
    for (int j = i + 1; j < points.size(); ++j) {
      auto d = dist(points[j], points[j - 1]);
      if (full + d <= t) {
        full += d, count += 1;
      } else {
        break;
      }
    }
    best = max(best, count);
    full = dist(points[i], start), count = 1;
    for (int j = i - 1; j >= 0; --j) {
      auto d = dist(points[j], points[j + 1]);
      if (full + d <= t) {
        full += d, count += 1;
      } else {
        break;
      }
    }
    best = max(best, count);
  }
  cout << best << '\n';
  return 0;
}
