#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256777216")
using namespace std;
const long double eps = 1e-12;
mt19937 rndm;
void start() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  cout.setf(ios::fixed);
  string FILENAME = "sort";
  rndm.seed(time(0));
}
const int MAX_N = 1e5 + 5;
const int MAX_M = 1e5 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;
vector<pair<unsigned long long, unsigned long long> > points;
unsigned long long xs, ys, t;
vector<long long> pref;
long long getDist(int l, int r) { return pref[r] - pref[l]; }
int getCnt(int l, int r) {
  unsigned long long maxCnt = 0;
  for (int i = l; i <= r; i++) {
    unsigned long long curT = 0;
    unsigned long long curCnt = 0;
    if (points[i].first > xs)
      curT += points[i].first - xs;
    else
      curT += xs - points[i].first;
    if (points[i].second > ys)
      curT += points[i].second - ys;
    else
      curT += ys - points[i].second;
    if (curT > t) continue;
    curCnt = 1;
    curT += getDist(l, r) + min(getDist(l, i), getDist(i, r));
    if (curT <= t) return r - l + 1;
  }
  return maxCnt;
}
void solve() {
  unsigned long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  points.push_back({x0, y0});
  while (true) {
    unsigned long long nX = points.back().first * ax + bx;
    unsigned long long nY = points.back().second * ay + by;
    if (nX >= 3e16 || nY >= 3e16) break;
    points.push_back({nX, nY});
  }
  int ans = 0;
  pref.assign(points.size(), 0);
  for (int i = 1; i < points.size(); i++)
    pref[i] = pref[i - 1] + (points[i].first - points[i - 1].first) +
              (points[i].second - points[i - 1].second);
  for (int i = 0; i < points.size(); i++) {
    for (int j = i; j < points.size(); j++) ans = max(ans, getCnt(i, j));
  }
  cout << ans;
}
void multitest() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}
int main() {
  start();
  solve();
  return 0;
}
