#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  vector<pair<long long, long long>> a;
  a.push_back({x0, y0});
  while (a.back().first <= 2e16 && a.back().second <= 2e16) {
    a.push_back({a.back().first * ax + bx, a.back().second * ay + by});
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)a.size(); i++) {
    for (long long j = i; j >= 0; j--) {
      for (long long k = i; k < (long long)a.size(); k++) {
        long long kek = abs(xs - a[i].first) + abs(a[i].first - a[j].first) +
                        abs(a[j].first - a[k].first) + abs(ys - a[i].second) +
                        abs(a[i].second - a[j].second) +
                        abs(a[j].second - a[k].second);
        if (kek <= t) {
          ans = max(ans, k - j + 1);
        }
        kek = abs(xs - a[i].first) + abs(a[i].first - a[k].first) +
              abs(a[j].first - a[k].first) + abs(ys - a[i].second) +
              abs(a[i].second - a[k].second) + abs(a[j].second - a[k].second);
        if (kek <= t) {
          ans = max(ans, k - j + 1);
        }
      }
    }
  }
  cout << ans << '\n';
}
