#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
double inff = 1.0 / 0.0;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long int x, y, n, i, z, j, k, w, u, q, m, t, g;
vector<pair<long long int, long long int> > v;
void solve() {
  long long int x0, y0, ax, ay, bx, by, limit = (1LL << 62) - 1;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> x >> y >> t;
  while (1) {
    v.push_back({x0, y0});
    if ((limit - bx) / ax < x0 or (limit - by) / ay < y0) break;
    u = ax * x0 + bx;
    q = ay * y0 + by;
    w += u + q - x0 - y0;
    x0 = u;
    y0 = q;
  }
  for (i = (int)0; i < (int)(int)v.size(); i++) {
    for (j = (int)i; j < (int)(int)v.size(); j++) {
      w = v[j].second - v[i].second + v[j].first - v[i].first;
      if (w <= t - min(llabs(v[j].second - y) + llabs(v[j].first - x),
                       llabs(v[i].second - y) + llabs(v[i].first - x)))
        k = max(k, j - i + 1);
    }
  }
  cout << k << "\n";
}
int main() {
  int TESTS = 1;
  ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  ;
  while (TESTS--) {
    solve();
  }
}
