#include <bits/stdc++.h>
using namespace std;
const long long int N = 3 * 1e6 + 2;
long long int n, k;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int x0, y0, ax, ay, bx, by;
  long long int xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  vector<long long int> x(1, x0);
  vector<long long int> y(1, y0);
  long long int curx = x0, cury = y0;
  while ((long double)(curx * ax + bx) < 1e17 &&
         (long double)(cury * ay + by) < 5e16) {
    curx = curx * ax + bx;
    cury = cury * ay + by;
    x.push_back(curx);
    y.push_back(cury);
  }
  n = x.size();
  long long int res = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i; j < n; j++) {
      long long int L = abs(xs - x[i]) + abs(ys - y[i]);
      long long int R = abs(xs - x[j]) + abs(ys - y[j]);
      long long int dist = abs(x[i] - x[j]) + abs(y[i] - y[j]);
      if (min(L, R) + dist <= t) {
        res = max(res, j - i + 1);
      }
    }
  }
  cout << res << '\n';
  return 0;
}
