#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  long long x_d = x0, y_d = y0;
  vector<pair<long long, long long> > data_points;
  while (x_d <= xs + t and y_d <= ys + t) {
    data_points.push_back(make_pair(x_d, y_d));
    long long xn = x_d * ax + bx;
    long long yn = y_d * ay + by;
    x_d = xn;
    y_d = yn;
  }
  auto Distance = [&](int i, int j) {
    long long d = abs(data_points[i].first - xs) +
                  abs(data_points[i].second - ys) +
                  abs(data_points[i].first - data_points[j].first) +
                  abs(data_points[i].second - data_points[j].second);
    return d;
  };
  int n = data_points.size();
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (Distance(i, j) <= t) {
        ans = max(abs(j - i) + 1, ans);
      }
    }
  }
  cout << ans << '\n';
}
