#include <bits/stdc++.h>
using namespace std;
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
signed main() {
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long, long long>> pts;
  pts.emplace_back(x0, y0);
  long long cx = x0;
  long long cy = y0;
  while (dist(xs, ys, cx, cy) < (long long)1e17) {
    cx = ax * cx + bx;
    cy = ay * cy + by;
    pts.emplace_back(cx, cy);
  }
  long long n = pts.size();
  vector<long long> fdist(n), bdist(n - 1);
  for (long long i = 0; i < n; ++i) {
    fdist[i] = dist(xs, ys, pts[i].first, pts[i].second);
  }
  for (long long i = 0; i < n - 1; ++i) {
    bdist[i] =
        dist(pts[i].first, pts[i].second, pts[i + 1].first, pts[i + 1].second);
  }
  long long answ = 0;
  for (long long s = 0; s < n; ++s) {
    long long ct = fdist[s];
    if (ct > t) {
      continue;
    }
    long long cur = 1;
    long long path = 0;
    for (long long i = s - 1; i >= 0; --i) {
      ct += bdist[i];
      path += bdist[i];
      if (ct > t) {
        break;
      }
      ++cur;
    }
    ct += path;
    for (long long i = s; i < n; ++i) {
      ct += bdist[i];
      if (ct > t) {
        break;
      }
      ++cur;
    }
    answ = max(answ, cur);
  }
  cout << answ;
  return 0;
}
