#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = (1ll << 31) - 1;
const int INF = 2e9 + 10;
const long long inf = 9e18 + 10;
const int MO = 1e9 + 7;
const double eps = 1e-8;
void err() { cout << endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
  cout << a << " ";
  err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &...args) {
  for (auto &it : arg) cout << it << " ";
  err(args...);
}
template <typename T>
void err(T a[], int l, int r) {
  for (int i = (l); i <= (r); ++i) cout << a[i] << " ";
  cout << endl;
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  x *= f;
  return;
}
const int N = 1e5 + 10;
long long x[N], y[N];
long long dis(int i, int j) { return abs(x[i] - x[j]) + abs(y[i] - y[j]); }
int bisearch(int l, int r, int i, long long T) {
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (dis(i, mid) <= T)
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int bifind(int l, int r, int i, long long T) {
  while (l < r) {
    int mid = (l + r) >> 1;
    if (dis(mid, i) <= T)
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int Work() {
  long long ax, ay, bx, by;
  long long xs, ys, T;
  scanf("%lld%lld%lld%lld%lld%lld%lld%lld%lld", &x[0], &y[0], &ax, &ay, &bx,
        &by, &xs, &ys, &T);
  int tot = 0;
  while (1) {
    long long nx = x[tot] * ax + bx, ny = y[tot] * ay + by;
    if (nx < 5e16 && ny < 5e16)
      x[++tot] = nx, y[tot] = ny;
    else
      break;
  }
  int ans = 0;
  for (int i = (0); i <= (tot); ++i) {
    long long d = abs(xs - x[i]) + abs(ys - y[i]);
    if (T - d < 0) continue;
    int c = bisearch(i, tot, i, T - d);
    ans = max(ans, c - i + 1);
  }
  for (int i = (tot); i >= (0); --i) {
    long long d = abs(xs - x[i]) + abs(ys - y[i]);
    if (T - d < 0) continue;
    int c = bifind(0, i, i, T - d);
    ans = max(ans, i - c + 1);
  }
  printf("%d\n", ans);
  return 0;
}
int main() {
  int t = 1;
  while (t--) Work();
  return 0;
}
