#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long x, y, ax, ay, bx, by;
  cin >> x >> y >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long, long long> > pos;
  pos.emplace_back(x, y);
  for (long long i = 1;; i++) {
    pos.emplace_back(pos[i - 1].first * ax + bx, pos[i - 1].second * ay + by);
    if (pos[i].first - xs + pos[i].second - ys > t) break;
  }
  long long bst = 0;
  for (long long i = 0; i < pos.size(); i++) {
    for (long long j = i; j < pos.size(); j++) {
      long long fl = abs(xs - pos[i].first) + abs(ys - pos[i].second);
      long long fr = abs(xs - pos[j].first) + abs(ys - pos[j].second);
      long long ans = min(fl, fr) + pos[j].first - pos[i].first +
                      pos[j].second - pos[i].second;
      if (ans <= t) bst = max(bst, j - i + 1);
    }
  }
  cout << bst;
}
