#include <bits/stdc++.h>
using namespace std;
long long dp[100005], a[100005];
const long long maxn = 1e5 + 10;
long long x[maxn], y[maxn];
signed main() {
  long long ax, ay, bx, by;
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  long long n;
  cin >> xs >> ys >> t;
  for (long long i = 1; i <= 70; i++) {
    x[i] = x[i - 1] * ax + bx;
    y[i] = y[i - 1] * ay + by;
    if (x[i] > 1e16 || y[i] > 1e16) {
      n = i;
      break;
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= n; i++) {
    long long res = t - abs(xs - x[i]) - abs(ys - y[i]);
    for (long long j = 0; j <= n; j++) {
      for (long long k = i; k <= n; k++) {
        long long L = abs(x[i] - x[j]) + abs(y[i] - y[j]);
        long long R = abs(x[i] - x[k]) + abs(y[i] - y[k]);
        long long need = min(L, R) + L + R;
        if (need <= res) {
          ans = max(ans, k - j + 1);
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
