#include <bits/stdc++.h>
using namespace std;
const int N = 105;
long long xx[N], yy[N], dis[N];
int main() {
  long long x0, y0, ax, ay, bx, by;
  scanf("%lld%lld%lld%lld%lld%lld", &x0, &y0, &ax, &ay, &bx, &by);
  long long xs, ys, t;
  scanf("%lld%lld%lld", &xs, &ys, &t);
  xx[0] = x0, yy[0] = y0;
  int i = 1, cnt1 = 0;
  while (xx[i - 1] <= (long long)(1e16) && yy[i - 1] <= (long long)(1e16)) {
    xx[i] = xx[i - 1] * ax + bx;
    yy[i] = yy[i - 1] * ay + by;
    dis[i] = abs(xx[i] - xx[i - 1]) + abs(yy[i] - yy[i - 1]);
    i++;
    cnt1++;
  }
  long long sum = 0;
  for (i = 0; i <= cnt1; ++i) {
    long long tmp1 = abs(xx[i] - xs) + abs(yy[i] - ys);
    long long cnt1_t1 = 0;
    int pos1 = i + 1;
    while (tmp1 <= t) {
      cnt1_t1++;
      if (pos1 > cnt1) break;
      tmp1 += dis[pos1++];
    }
    sum = max(sum, cnt1_t1);
    cnt1_t1 = 0;
    pos1 = i;
    tmp1 = abs(xx[i] - xs) + abs(yy[i] - ys), cnt1_t1 = 0;
    while (tmp1 <= t) {
      cnt1_t1++;
      if (pos1 == 0) break;
      tmp1 += dis[pos1--];
    }
    sum = max(sum, cnt1_t1);
  }
  printf("%lld\n", sum);
  return 0;
}
