#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Pii = pair<int, int>;
int uplg(int n) { return 32 - __builtin_clz(n); }
int uplg(ll n) { return 64 - __builtin_clzll(n); }
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(18);
  run();
  return 0;
}
using Pll = pair<ll, ll>;
constexpr ll INF = 2e17;
ll safeMul(ll a, ll b) {
  if (!a || !b) return 0;
  if (INF / a < b) return INF;
  return min(a * b, INF);
}
ll dist(Pll a, Pll b) {
  return min(abs(a.first - b.first) + abs(a.second - b.second), INF);
}
void run() {
  ll x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  ll xs, ys, t;
  cin >> xs >> ys >> t;
  vector<Pll> points;
  points.push_back({x0, y0});
  while (true) {
    ll first = points.back().first, second = points.back().second;
    if (first >= INF || second >= INF) break;
    ll x2 = min(safeMul(ax, first) + bx, INF);
    ll y2 = min(safeMul(ay, second) + by, INF);
    points.push_back({x2, y2});
  }
  int ans = 0;
  for (int first = (0); first < (int((points).size())); first++) {
    ll to = dist({xs, ys}, points[first]);
    for (int left = (0); left < (first + 1); left++) {
      for (int right = (first); right < (int((points).size())); right++) {
        ll d1 = min(to + dist(points[first], points[left]) +
                        dist(points[left], points[right]),
                    INF);
        ll d2 = min(to + dist(points[first], points[right]) +
                        dist(points[right], points[left]),
                    INF);
        if (d1 <= t || d2 <= t) {
          ans = max(ans, right - left + 1);
        }
      }
    }
  }
  cout << ans << endl;
}
