#include <bits/stdc++.h>
using namespace std;
const long long LIM = 2e16;
long long dist(pair<long long, long long> a, pair<long long, long long> b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  vector<long long> x, y;
  x.push_back(x0);
  y.push_back(y0);
  while (x.back() * ax + bx <= LIM && y.back() * ay + by <= LIM) {
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  int m = x.size();
  pair<long long, long long> second = {xs, ys};
  int mx = 0;
  for (int z = 0; z < m; z++) {
    for (int i = 0; i <= z; i++) {
      for (int j = z; j < m; j++) {
        pair<long long, long long> l = {x[i], y[i]}, r = {x[j], y[j]},
                                   zz = {x[z], y[z]};
        if (j == z) {
          if (dist(zz, l) + dist(second, zz) <= t) {
            mx = max(mx, j - i + 1);
          }
        } else if (i == z) {
          if (dist(zz, r) + dist(second, zz) <= t) {
            mx = max(mx, j - i + 1);
          }
        } else if (dist(zz, l) + dist(second, zz) + dist(r, l) <= t) {
          mx = max(mx, j - i + 1);
        }
      }
    }
  }
  cout << mx;
  return 0;
}
