#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x0;
  cin >> x0;
  long long y0;
  cin >> y0;
  long long ax;
  cin >> ax;
  long long ay;
  cin >> ay;
  long long bx;
  cin >> bx;
  long long by;
  cin >> by;
  long long xs;
  cin >> xs;
  long long ys;
  cin >> ys;
  long long t;
  cin >> t;
  vector<long long> x;
  x.push_back(x0);
  vector<long long> y;
  y.push_back(y0);
  long long L = (1LL << 62) - 1;
  while ((L - bx) / ax >= x.back() && (L - by) / ay >= y.back()) {
    x.push_back(ax * x.back() + bx);
    y.push_back(ay * y.back() + by);
  }
  long long n = x.size();
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      long long length = x[j] - x[i] + y[j] - y[i];
      long long dleft = abs(xs - x[i]) + abs(ys - y[i]);
      long long dright = abs(xs - x[j]) + abs(ys - y[j]);
      if (length <= t - dleft || length <= t - dright) {
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
