#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
const int N = 1e6 + 4;
long long INF = 2e18;
int main() {
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  vector<long long> x(1, x0), y(1, y0);
  long long sx, sy, t;
  cin >> sx >> sy >> t;
  while ((INF - bx) / ax >= x.back() && (INF - by) / ay >= y.back()) {
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  int ans = 0;
  for (int i = 0; i < (int)x.size(); i++) {
    for (int j = i; j < (int)x.size(); j++) {
      long long dist = abs(x[j] - x[i]) + abs(y[j] - y[i]);
      if (dist + min(abs(x[j] - sx) + abs(y[j] - sy),
                     abs(x[i] - sx) + abs(y[i] - sy)) <=
          t) {
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
