#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
const long long INF = 1e18;
long long X[100], Y[100];
long long ax, ay, bx, by, sx, sy, t;
int ans = 0, num = 0;
int rua() {
  scanf("%lld%lld%lld%lld%lld%lld", &X[0], &Y[0], &ax, &ay, &bx, &by);
  scanf("%lld%lld%lld", &sx, &sy, &t);
  for (int i = 1; i <= 80; i++) {
    X[i] = ax * X[i - 1] + bx;
    Y[i] = ay * Y[i - 1] + by;
    if (X[i] - sx >= t || Y[i] - sy >= t) {
      num = i;
      break;
    }
  }
  for (int i = 0; i < num; i++) {
    for (int j = 0; j < num; j++) {
      long long tmp =
          abs(sx - X[i]) + abs(sy - Y[i]) + abs(X[i] - X[j]) + abs(Y[i] - Y[j]);
      if (tmp <= t) ans = max(ans, abs(i - j) + 1);
    }
  }
  return ans;
}
int main() {
  printf("%d\n", rua());
  return 0;
}
