#include <bits/stdc++.h>
using namespace std;
int ans;
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  scanf("%lld%lld%lld%lld%lld%lld%lld%lld%lld", &x0, &y0, &ax, &ay, &bx, &by,
        &xs, &ys, &t);
  vector<pair<long long, long long> > v;
  v.push_back({x0, y0});
  for (;;) {
    pair<long long, long long> p1 = v.back();
    pair<long long, long long> p2 = {ax * p1.first + bx, ay * p1.second + by};
    v.push_back(p2);
    if (max(p2.first, p2.second) > 5e16) break;
  }
  int sz = (int)(v.size());
  for (int i = 0; i < sz; i++)
    for (int j = i; j < sz; j++)
      if (dist(v[i].first, v[i].second, v[j].first, v[j].second) +
              min(dist(xs, ys, v[i].first, v[i].second),
                  dist(xs, ys, v[j].first, v[j].second)) <=
          t)
        ans = max(ans, j - i + 1);
  printf("%d\n", ans);
}
