#include <bits/stdc++.h>
using namespace std;
long long n, ax, ay, bx, by, xs, ys, t, ans, x[100], y[100], d[100];
long long dist(long long x, long long y, long long xx, long long yy) {
  return abs(x - xx) + abs(y - yy);
}
signed main() {
  scanf("%lld%lld%lld%lld%lld%lld%lld%lld%lld", &x[0], &y[0], &ax, &ay, &bx,
        &by, &xs, &ys, &t);
  for (n = 0; n + 1 < 100; ++n) {
    x[n + 1] = ax * x[n] + bx;
    y[n + 1] = ay * y[n] + by;
    d[n] = x[n + 1] - x[n] + y[n + 1] - y[n];
    if (x[n + 1] > xs + t || y[n + 1] > ys + t) break;
  }
  for (long long i = 0; i <= n; ++i) {
    if (dist(x[i], y[i], xs, ys) > t) continue;
    long long tmp = 1, sum = 0, rest = t - dist(x[i], y[i], xs, ys);
    for (long long j = i - 1; j >= 0 && rest >= d[j]; --j)
      rest -= d[j], ++tmp, sum += d[j];
    rest -= sum;
    for (long long j = i; j <= n && rest >= d[j]; ++j) rest -= d[j], ++tmp;
    ans = max(ans, tmp);
  }
  printf("%lld\n", ans);
  return 0;
}
