#include <bits/stdc++.h>
using namespace std;
void USACO(string s) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
long long x[100], y[100], ax, ay, bx, by, xs, ys, t;
void solve() {
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by >> xs >> ys >> t;
  int z, ans = 0;
  for (z = 1; x[z - 1] < 3e16 && y[z - 1] < 3e16; z++) {
    x[z] = ax * x[z - 1] + bx;
    y[z] = ay * y[z - 1] + by;
  }
  for (int i = 0; i < z; i++) {
    for (int j = 0; j < z; j++) {
      if (abs(x[i] - xs) + abs(y[i] - ys) + abs(x[i] - x[j]) +
              abs(y[i] - y[j]) <=
          t) {
        ans = max(ans, abs(j - i) + 1);
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
