#include <bits/stdc++.h>
using namespace std;
struct lex_compare {
  bool operator()(const int& a, const int& b) const { return a < b; }
};
void solve() {
  long long x0, y0, ax, bx, ay, by, xs, ys, t, cx, cy;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  cx = x0, cy = y0;
  vector<pair<long long, long long>> v;
  while (true) {
    if (abs(cx - xs) + abs(cy - ys) <= t || (xs >= cx && ys >= cy)) {
      v.push_back({cx, cy});
      cx = ax * cx + bx;
      cy = ay * cy + by;
    } else {
      break;
    }
  }
  int ma = 0;
  for (int i = 0; i < v.size(); i++) {
    long long d1 = abs(xs - v[i].first) + abs(ys - v[i].second);
    for (int j = i; j < v.size(); j++) {
      long long d2 = abs(xs - v[j].first) + abs(ys - v[j].second);
      long long d3 =
          abs(v[j].first - v[i].first) + abs(v[j].second - v[i].second);
      long long d = min(d1, d2) + d3;
      if (d <= t) {
        ma = max(ma, j - i + 1);
      }
    }
  }
  cout << ma << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
