#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long x[64], y[64];
  x[0] = x0;
  y[0] = y0;
  int i = 1;
  while ((ax * x[i - 1] + bx) <= (2ll * 10000000000000000ll)) {
    x[i] = ax * x[i - 1] + bx;
    i++;
  }
  int ii = 1;
  while ((ay * y[ii - 1] + by) <= (2ll * 10000000000000000ll)) {
    y[ii] = ay * y[ii - 1] + by;
    ii++;
  }
  long long val, ans = 0;
  for (int j = 0; j < min(i, ii); j++) {
    for (int k = 0; k < min(i, ii); k++) {
      val =
          abs(xs - x[j]) + abs(ys - y[j]) + abs(x[k] - x[j]) + abs(y[k] - y[j]);
      if (val <= t) ans = max(ans, (long long)abs(k - j) + (long long)1);
    }
  }
  cout << ans << "\n";
  return 0;
}
