#include <bits/stdc++.h>
using namespace std;
void DBG() { cerr << "]\n"; }
template <typename T, typename... Args>
void DBG(T first, Args... args) {
  cerr << first;
  if (sizeof...(args)) cerr << ", ";
  DBG(args...);
}
void solve() {
  long long int x0, y0, ax, ay, bx, by, sx, sy, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> sx >> sy >> t;
  vector<long long int> px, py;
  px.push_back(x0);
  py.push_back(y0);
  while (true) {
    long long bound = 0;
    if (px.back() > sx) {
      bound += px.back() - sx;
    }
    if (py.back() > sy) {
      bound += py.back() - sy;
    }
    if (bound > t) {
      px.pop_back();
      py.pop_back();
      break;
    }
    px.push_back(px.back() * ax + bx);
    py.push_back(py.back() * ay + by);
  }
  long long int n = px.size();
  long long int g = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i; j < n; j++) {
      long long int from_i = abs(sx - px[i]) + abs(sy - py[i]);
      long long int from_j = abs(sx - px[j]) + abs(sy - py[j]);
      long long int cnt =
          min(from_i, from_j) + abs(px[i] - px[j]) + abs(py[i] - py[j]);
      if (cnt <= t) {
        g = max(g, j - i + 1);
      }
    }
  }
  cout << g << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t = 1;
  for (long long int tt = 1; tt <= t; tt++) {
    solve();
  }
}
