#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long xo, yo, ax, ay, bx, by;
  cin >> xo >> yo >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<long long> x, y;
  x.push_back(xo);
  y.push_back(yo);
  while (x.back() * ax + bx < 1e18 && x.back() * ax + bx > x.back() &&
         y.back() * ay + by < 1e18 && y.back() * ay + by > y.back()) {
    x.push_back(x.back() * ax + bx);
    y.push_back(y.back() * ay + by);
  }
  long long ans = 0;
  long long n = x.size();
  for (long long i = n - 1; i >= 0; i--) {
    long long cans = 0;
    if ((abs(xs - x[i]) + abs(ys - y[i])) <= t) {
      long long tlft = t - (abs(xs - x[i]) + abs(ys - y[i]));
      long long cans1 = 0, tlft1 = tlft;
      for (long long j = i; j >= 1; j--) {
        if ((abs(x[j] - x[j - 1]) + abs(y[j] - y[j - 1])) <= tlft1) {
          cans1++;
          tlft1 -= (abs(x[j] - x[j - 1]) + abs(y[j] - y[j - 1]));
        } else
          break;
      }
      long long cans2 = 0, tlft2 = tlft;
      for (long long j = i; j < n - 1; j++) {
        if ((abs(x[j] - x[j + 1]) + abs(y[j] - y[j + 1])) <= tlft2) {
          cans2++;
          tlft2 -= (abs(x[j] - x[j + 1]) + abs(y[j] - y[j + 1]));
        } else
          break;
      }
      cans = max(cans1, cans2) + 1;
    }
    ans = max(ans, cans);
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
