#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long x0, y0, ax, ay, bx, by;
  int i, j;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  vector<long long> x(1, x0);
  vector<long long> y(1, y0);
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  while (1) {
    long long bnd = 0;
    if (x.back() > xs) {
      bnd += x.back() - xs;
    }
    if (y.back() > ys) {
      bnd += y.back() - ys;
    }
    if (bnd > t) {
      x.pop_back();
      y.pop_back();
      break;
    }
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  int n = (int)x.size();
  int answer = 0;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      long long dx = x[j] - x[i];
      long long dy = y[j] - y[i];
      long long to_i = abs(xs - x[i]) + abs(ys - y[i]);
      long long to_j = abs(xs - x[j]) + abs(ys - y[j]);
      long long cur = min(to_i, to_j) + dx + dy;
      if (cur <= t) {
        answer = max(answer, j - i + 1);
      }
    }
  }
  cout << answer << endl;
  return 0;
}
