#include <bits/stdc++.h>
using namespace std;
const int MAXn = 3e5 + 5;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  long long limit = 10e16 + 1;
  vector<long long> x, y;
  x.push_back(x0);
  y.push_back(y0);
  while (((limit - bx) / ax >= x.back()) && ((limit - by) / ay >= y.back())) {
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  int ans = 0;
  int n = x.size();
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      long long segment = x[j] - x[i] + y[j] - y[i];
      long long temp =
          min(abs(x[i] - xs) + abs(y[i] - ys), abs(x[j] - xs) + abs(y[j] - ys));
      if (temp + segment <= t) ans = max(ans, j - i + 1);
    }
  }
  cout << ans;
}
