#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long bpow(long long a, long long b) {
  long long ans = 1;
  while (b != 0) {
    if (b % 2) ans = ans * a;
    a = a * a;
    b /= 2;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long x0, y0, ax, bx, ay, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  long long sum = xs + ys, sub = xs - ys;
  long long val = 1, val1 = 1, i = 0;
  long long count = 0;
  vector<long long> x(1, x0), y(1, y0);
  while (x.back() <= (1000000000000000000 - bx) / ax &&
         y.back() <= (1000000000000000000 - by) / ay) {
    x.push_back(ax * x.back() + bx);
    y.push_back(ay * y.back() + by);
  }
  long long n = x.size();
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      long long len = x[j] - x[i] + y[j] - y[i];
      long long disl = abs(xs - x[i]) + abs(ys - y[i]);
      long long disr = abs(xs - x[j]) + abs(ys - y[j]);
      if (len <= t - disl || len <= t - disr) count = max(count, j - i + 1);
    }
  }
  cout << count;
  return 0;
}
