#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(const T& v) {
  cerr << v << ' ';
}
template <typename T1, typename... T2>
void print(const T1& first, const T2&... rest) {
  print(first);
  print(rest...);
}
typedef priority_queue<pair<int, int>, vector<pair<int, int> >,
                       greater<pair<int, int> > >
    pq;
int setbit(int N, int pos) { return N = N | (1 << pos); }
int resetbit(int N, int pos) { return N = N & ~(1 << pos); }
bool checkbit(int N, int pos) { return (bool)(N & (1 << pos)); }
int nextN(int N) { return N + (N & (-N)); }
int parentN(int N) { return N - (N & (-N)); }
template <typename T>
T extGcd(T a, T b, T& x, T& y) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  T x1, y1, gcd = extGcd(b % a, a, &x1, &y1);
  x = y1 - (b / a) * x1, y = x1;
  return gcd;
}
template <typename T>
T bigMod(T a, T p, T m) {
  if (p == 1) return a;
  T x = bigMod(a, p / 2, m) % m;
  x = (x * x) % m;
  return (p & 1) ? (x * a) % m : x;
}
template <typename T>
T modMul(T a, T b, T m) {
  return ((a % m) * (b % m)) % m;
}
template <typename T>
T modAdd(T a, T b, T m) {
  return ((a % m) + (b % m)) % m;
}
template <typename T>
T modSub(T a, T b, T m) {
  return (a - b + m) % m;
}
template <typename T>
T modInverse(T a, T m) {
  return bigMod(a, m - 2, m);
}
const long long m = 1e16;
int n = 0;
long long x[64], y[64], ds[64], dp[64];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long x0, y0, ax, ay, bx, by, xs, ys, t, nextx, nexty;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  x[0] = x0, y[0] = y0;
  ds[n] = abs(xs - x[0]) + abs(ys - y[0]);
  n++;
  while (1) {
    nextx = ax * x[n - 1] + bx;
    nexty = ay * y[n - 1] + by;
    long long d = abs(xs - nextx) + abs(ys - nexty);
    if (d > 2LL * m) break;
    x[n] = nextx, y[n] = nexty, ds[n] = d;
    n++;
  }
  for (int i = 1; i <= n - 1; ++i)
    dp[i] = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
  long long ans = 0;
  for (int i = 0; i <= n - 1; ++i) {
    long long tm = ds[i], cnt = 0, j = i;
    while (tm <= t && j < n) {
      cnt++;
      tm += dp[++j];
    }
    ans = max(ans, cnt);
  }
  for (int i = n - 1; i >= 0; --i) {
    long long tm = ds[i], cnt = 0, j = i;
    while (tm <= t && j >= 0) {
      cnt++;
      tm += dp[j--];
    }
    ans = max(ans, cnt);
  }
  cout << ans;
  return 0;
}
