#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long INF = 1e17 + 7;
const int N = 1e4 + 7;
const int M = 5e6 + 7;
long long x[N], y[N];
long long ax, ay, bx, by, a, b, t;
signed main() {
  ios::sync_with_stdio(false);
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;
  int n = 0;
  for (; x[n] < INF && y[n] < INF; n++) {
    x[n + 1] = x[n] * ax + bx;
    y[n + 1] = y[n] * ay + by;
    if (x[n + 1] >= INF || y[n + 1] >= INF) break;
  }
  cin >> a >> b >> t;
  long long ans = 0;
  for (int l = 0; l <= n; l++) {
    for (int r = l; r <= n; r++) {
      unsigned long long to =
          min(abs(a - x[l]) + abs(b - y[l]), abs(a - x[r]) + abs(b - y[r]));
      to += abs(x[l] - x[r]) + abs(y[l] - y[r]);
      if (to <= t) ans = max(ans, r - l + 1ll);
    }
  }
  cout << ans << "\n";
  return 0;
}
