#include <bits/stdc++.h>
using namespace std;
const long long INF = 3e16;
const int N = 1e5 + 10;
long long int x, y, ax, ay, bx, by;
long long int xs, ys, t;
vector<pair<long long int, long long int> > v;
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> x >> y >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long curx = x, cury = y;
  if (dist(xs, ys, curx, cury) <= t) {
    v.push_back({curx, cury});
  }
  for (int i = 0; i < 100; ++i) {
    curx = curx * ax + bx;
    cury = cury * ay + by;
    if (curx > INF || cury > INF) break;
    if (dist(xs, ys, curx, cury) <= t) {
      v.push_back({curx, cury});
    }
  }
  int sz = v.size();
  int ct = 0;
  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[j].first, v[j].second),
                  dist(v[i].first, v[i].second, xs, ys)) <=
          t)
        ct = max(ct, j - i + 1);
    }
  }
  cout << ct;
}
