#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  return x * f;
}
long long k, m, n;
long long x0, hhakioi, ax, ay, bx, by, x, y, t;
struct node {
  long long x, y;
} a[maxn];
long long tot = 0;
signed main() {
  x0 = read();
  hhakioi = read();
  ax = read();
  ay = read();
  bx = read();
  by = read();
  x = read();
  y = read();
  t = read();
  long long now = 1;
  for (;; now++) {
    a[++tot] = (node){x0, hhakioi};
    x0 = ax * x0 + bx;
    hhakioi = ay * hhakioi + by;
    if (x0 >= 2e16 || hhakioi >= 2e16) break;
  }
  long long ans = 0;
  for (register long long i = 1; i <= tot; i++) {
    for (register long long j = i; j <= tot; j++) {
      long long min_ = abs(x - a[i].x) + abs(y - a[i].y) +
                       abs(a[j].x - a[i].x) + abs(a[j].y - a[i].y);
      min_ = min(min_, abs(x - a[j].x) + abs(y - a[j].y) +
                           abs(a[j].x - a[i].x) + abs(a[j].y - a[i].y));
      if (min_ <= t) ans = max(ans, j - i + 1);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
