#include <bits/stdc++.h>
using namespace std;
const int N = 74;
long long x[N], y[N], ax, ay, bx, by, xs, ys, q, INF = 30000000000000000;
int p = 1;
long long dis(long long xa, long long ya, long long xb, long long yb) {
  return ((xa - xb) > 0 ? (xa - xb) : -(xa - xb)) +
         ((ya - yb) > 0 ? (ya - yb) : -(ya - yb));
}
int main() {
  scanf("%lld %lld %lld %lld %lld %lld", &x[0], &y[0], &ax, &ay, &bx, &by);
  for (p = 1;; p++) {
    x[p] = x[p - 1] * ax + bx;
    y[p] = y[p - 1] * ay + by;
    if (x[p] >= INF || y[p] >= INF) break;
  }
  scanf("%lld %lld %lld", &xs, &ys, &q);
  int ans = 0;
  for (int j = 0; j < p; j++) {
    long long rest = q - dis(xs, ys, x[j], y[j]);
    if (rest < 0) continue;
    int c = 1;
    for (int i = j; i > 0; i--) {
      long long d = dis(x[i], y[i], x[i - 1], y[i - 1]);
      if (d > rest) break;
      rest -= d;
      ++c;
    }
    long long d = dis(x[j + 1], y[j + 1], x[0], y[0]);
    if (d > rest) {
      ans = max(ans, c);
      continue;
    }
    rest -= d;
    ++c;
    for (int i = j + 1; i < p; i++) {
      long long d = dis(x[i], y[i], x[i + 1], y[i + 1]);
      if (d > rest) break;
      rest -= d;
      ++c;
    }
    ans = max(ans, c);
  }
  printf("%d\n", ans);
}
