#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
long long power(long long a, long long b, long long p) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % p;
    }
    a = (a * a) % p;
    b = b >> 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long no_factors(long long n) {
  long long ans = 0;
  for (int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        ans++;
      else
        ans += 2;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  vector<long long> x(1, x0), y(1, y0);
  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);
  }
  int n = x.size();
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int 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 << endl;
  return 0;
}
