#include <bits/stdc++.h>
using namespace std;
long long int dist(pair<long long int, long long int> p1,
                   pair<long long int, long long int> p2) {
  return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}
vector<pair<long long int, long long int> > nodes;
long long int x0, Y0, ax, ay, bx, by;
long long int xs, ys, t;
long long int n;
long long int ans = 0;
int32_t main() {
  cin >> x0 >> Y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  pair<long long int, long long int> calc_node = {x0, Y0};
  pair<long long int, long long int> starting_node = {xs, ys};
  for (long long int i = 1; i <= 100; i++) {
    if (dist(starting_node, calc_node) <= t) {
      nodes.push_back(calc_node);
    }
    calc_node = {calc_node.first * ax + bx, calc_node.second * ay + by};
    if (dist(starting_node, calc_node) > t &&
        (calc_node.first > starting_node.first ||
         calc_node.second > starting_node.second)) {
      break;
    }
  }
  for (long long int l = 0; l < nodes.size(); l++) {
    for (long long int r = l; r < nodes.size(); r++) {
      for (long long int go = l; go <= r; go++) {
        long long int totdist =
            dist(starting_node, nodes[go]) +
            min(dist(nodes[go], nodes[l]), dist(nodes[go], nodes[r])) +
            dist(nodes[l], nodes[r]);
        if (totdist <= t) {
          ans = max(ans, r - l + 1);
        }
      }
    }
  }
  cout << ans;
}
