#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long x0, y0, xs, ys;
  long long ax, ay, bx, by, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long LIMIT = (1ll << 62) - 1;
  vector<long long> x, y;
  x.push_back(x0);
  y.push_back(y0);
  while ((LIMIT - bx) / ax >= x.back() && (LIMIT - by) / ay >= y.back()) {
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  long long n = x.size();
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      long long len = abs(x[i] - x[j]) + abs(y[i] - y[j]);
      long long left = abs(xs - x[i]) + abs(ys - y[i]);
      long long right = abs(xs - x[j]) + abs(ys - y[j]);
      if (len <= t - left || len <= t - right) ans = max(ans, j - i + 1);
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long T = 1;
  while (T--) solve();
}
