#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t, i, temp1, temp2, j;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  vector<pair<long long, long long> > nodes;
  nodes.push_back(make_pair(x0, y0));
  for (i = 0; i < 100; i++) {
    temp1 = ax * nodes[i].first + bx;
    temp2 = ay * nodes[i].second + by;
    nodes.push_back(make_pair(temp1, temp2));
    if ((temp1 - xs + temp2 - ys) > t) break;
  }
  vector<long long> dist;
  dist.push_back(0);
  long long count = 0, cmax = 0;
  for (i = 1; i < nodes.size(); i++) {
    dist.push_back(dist[i - 1] + abs(nodes[i].first - nodes[i - 1].first) +
                   abs(nodes[i].second - nodes[i - 1].second));
  }
  for (i = 0; i < dist.size(); i++) {
    count = 0;
    temp1 = abs(nodes[i].first - xs) + abs(nodes[i].second - ys);
    for (j = i; j < dist.size(); j++) {
      temp2 = abs(nodes[j].first - xs) + abs(nodes[j].second - ys);
      if ((dist[j] - dist[i] + min(temp1, temp2)) <= t) count++;
    }
    if (count > cmax) cmax = count;
  }
  cout << cmax;
}
