#include <bits/stdc++.h>
using namespace std;
long long x[10000];
long long y[10000];
int main() {
  long long ax, ay, bx, by, x0, y0;
  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[0] = x0;
  y[0] = y0;
  int cnt;
  for (int i = 1; i < 1000; i++) {
    x[i] = x[i - 1] * ax + bx;
    y[i] = y[i - 1] * ay + by;
    if (x[i] > 2e16 || y[i] > 2e16) {
      cnt = i;
      break;
    }
  }
  int ans = 0;
  for (int i = 0; i <= cnt; i++) {
    long long tem = t;
    tem -= abs(x[i] - xs) + abs(y[i] - ys);
    if (tem < 0) continue;
    for (int j = i; j <= cnt; j++) {
      if (x[j] - x[i] + y[j] - y[i] > tem) {
        ans = max(ans, j - i);
        break;
      }
      if (j == cnt) ans = max(ans, j - i + 1);
    }
    for (int j = i; j >= 0; j--) {
      if (x[i] - x[j] + y[i] - y[j] > tem) {
        ans = max(ans, i - j);
        break;
      }
      if (j == 0) ans = max(ans, i + 1);
    }
  }
  printf("%d", ans);
  return 0;
}
