#include <bits/stdc++.h>
using namespace std;
const long long INF = 5e16;
const long long MOD = 1e9 + 7;
const long long MB = 30;
const long long K = 500;
void solve() {
  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;
  while (x0 < INF && y0 < INF) {
    a.push_back({x0, y0});
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
  }
  long long ans = 0;
  for (long long i = 0; i < a.size(); i++) {
    long long d = abs(a[i].first - xs) + abs(a[i].second - ys);
    if (d > t) continue;
    long long res = 1;
    for (long long j = i + 1; j < a.size(); j++) {
      d +=
          abs(a[j].first - a[j - 1].first) + abs(a[j].second - a[j - 1].second);
      if (d > t) break;
      res++;
    }
    ans = max(ans, res);
    res = 1;
    d = abs(a[i].first - xs) + abs(a[i].second - ys);
    for (long long j = i - 1; j >= 0; j--) {
      d +=
          abs(a[j].first - a[j + 1].first) + abs(a[j].second - a[j + 1].second);
      if (d > t) break;
      res++;
    }
    ans = max(ans, res);
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed;
  cout.precision(12);
  solve();
}
