#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 1e4;
long long x[maxn], y[maxn];
int main() {
  long long x0, y0, ax, ay, bx, by;
  long long xs, ys, t;
  scanf("%lld%lld%lld%lld%lld%lld", &x0, &y0, &ax, &ay, &bx, &by);
  scanf("%lld%lld%lld", &xs, &ys, &t);
  x[1] = x0;
  y[1] = y0;
  long long n = 1;
  for (int i = 2;; i++) {
    x[i] = ax * x[i - 1] + bx;
    y[i] = ay * y[i - 1] + by;
    if (x[i] > 1e17 || y[i] > 1e17) {
      n = i;
      break;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (fabs(x[i] - xs) + fabs(y[i] - ys) <= t) {
      long long rest = t - (fabs(x[i] - xs) + fabs(y[i] - ys));
      long long sum = 1;
      for (int j = i + 1; j <= n; j++) {
        if (fabs(x[j] - x[j - 1]) + fabs(y[j] - y[j - 1]) <= rest) {
          rest -= (fabs(x[j] - x[j - 1]) + fabs(y[j] - y[j - 1]));
          sum++;
        } else
          break;
      }
      ans = max(ans, sum);
      rest = t - (fabs(x[i] - xs) + fabs(y[i] - ys));
      sum = 1;
      for (int j = i - 1; j >= 1; j--) {
        if (fabs(x[j] - x[j + 1]) + fabs(y[j] - y[j + 1]) <= rest) {
          rest -= (fabs(x[j] - x[j + 1]) + fabs(y[j] - y[j + 1]));
          sum++;
        } else
          break;
      }
      ans = max(ans, sum);
    }
  }
  printf("%lld\n", ans);
}
