#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long fx[] = {+1, -1, +0, +0};
const long long fy[] = {+0, +0, +1, -1};
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
long long xo, yo, ax, ay, bx, by, xs, ys, t;
void solve() {
  cin >> xo >> yo >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  vector<long long> x(1, xo), y(1, yo);
  long long LIMIT = (1LL << 62) - 1;
  while ((LIMIT - bx) / ax >= x.back() && (LIMIT - by) / ay >= y.back()) {
    x.push_back(ax * x.back() + bx);
    y.push_back(ay * y.back() + by);
  }
  long long n = x.size();
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      long long length = x[j] - x[i] + y[j] - y[i];
      long long dist2Left = abs(xs - x[i]) + abs(ys - y[i]);
      long long dist2Right = abs(xs - x[j]) + abs(ys - y[j]);
      if (length <= t - dist2Left || length <= t - dist2Right)
        ans = max(ans, j - i + 1);
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
