#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
long long a1, b1, a2, b2, T, sx, sy;
long long x[maxn], y[maxn];
int tot;
int calc(int st) {
  long long t = T;
  if (abs(x[st] - sx) + abs(y[st] - sy) > t) return 0;
  int ret = 1;
  t -= abs(x[st] - sx) + abs(y[st] - sy);
  for (int i = st - 1; i >= 0; i--) {
    if (abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]) > t) return ret;
    ret++;
    t -= abs(x[i] - x[i + 1]) + abs(y[i] - y[i + 1]);
  }
  if (abs(x[st + 1] - x[0]) + abs(y[st + 1] - y[0]) > t || st == tot)
    return ret;
  t -= abs(x[st + 1] - x[0]) + abs(y[st + 1] - y[0]);
  ret++;
  for (int i = st + 2; i <= tot; i++) {
    if (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) > t) return ret;
    ret++;
    t -= abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
  }
  return ret;
}
int main() {
  scanf("%lld %lld %lld %lld %lld %lld", &x[0], &y[0], &a1, &a2, &b1, &b2);
  scanf("%lld %lld %lld", &sx, &sy, &T);
  while (1) {
    if (x[tot] * a1 + b1 > 2e16 || y[tot] * a2 + b2 > 2e16) break;
    tot++;
    x[tot] = x[tot - 1] * a1 + b1;
    y[tot] = y[tot - 1] * a2 + b2;
  }
  int ans = 0;
  for (int i = 0; i <= tot; i++) ans = max(ans, calc(i));
  printf("%d\n", ans);
  return 0;
}
