#include <bits/stdc++.h>
using namespace std;
long long A[1000], B[1000];
int main() {
  long long a1, a2, b1, b2, S, T, t;
  cin >> A[1] >> B[1] >> a1 >> a2 >> b1 >> b2;
  cin >> S >> T >> t;
  int sum = 0, i, j, k, m;
  for (i = 2; i <= 100; i++) {
    A[i] = A[i - 1] * a1 + b1;
    B[i] = B[i - 1] * a2 + b2;
    if (A[i] > 3e16 || B[i] > 3e16) {
      m = i - 1;
      break;
    }
  }
  long long ans, aa, bb;
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= i; j++) {
      for (k = i; k <= m; k++) {
        ans = abs(A[i] - S) + abs(B[i] - T);
        aa = abs(A[i] - A[j]) + abs(B[i] - B[j]);
        bb = abs(A[i] - A[k]) + abs(B[i] - B[k]);
        ans += aa + bb;
        ans += min(aa, bb);
        if (ans <= t) sum = max(sum, k - j + 1);
      }
    }
  }
  cout << sum << endl;
}
