#include <bits/stdc++.h>
using namespace std;
long long dst(pair<long long, long long> p1, pair<long long, long long> p2) {
  return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}
int main() {
  long long x, y, ax, ay, bx, by;
  cin >> x >> y >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long, long long>> coords;
  coords.reserve(100);
  long long dist = 0;
  coords.push_back(make_pair(x, y));
  int ind = 0;
  while (coords[ind].first <= 1e16 && coords[ind].second <= 1e16) {
    coords.push_back(
        make_pair(coords[ind].first * ax + bx, coords[ind].second * ay + by));
    ++ind;
    dist = dst(coords[ind], coords[ind - 1]);
  }
  int res = 0;
  auto str = make_pair(xs, ys);
  for (int i = 0; i < coords.size(); ++i) {
    long long tmp = dst(str, coords[i]);
    if (tmp > t) continue;
    int tmpres = 0;
    int cur = i;
    bool reverted = false;
    do {
      ++tmpres;
      int nxt = cur;
      if (reverted)
        ++nxt;
      else if (cur)
        --nxt;
      else {
        reverted = true;
        nxt = i + 1;
      }
      tmp += dst(coords[cur], coords[nxt]);
      cur = nxt;
    } while (tmp <= t);
    if (tmpres > res) res = tmpres;
    tmpres = 0;
    cur = i;
    do {
      ++tmpres;
      tmp += dst(coords[cur], coords[++cur]);
    } while (tmp < t);
    if (tmpres > res) res = tmpres;
  }
  cout << res << endl;
  return 0;
}
