#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  vector<pair<long long int, long long int> > v;
  int cnt = 0;
  long long int x = x0, y = y0;
  v.push_back({x0, y0});
  while (x <= xs + t * 2 && y <= ys + t * 2) {
    x = x * ax + bx;
    y = y * ay + by;
    cnt++;
    v.push_back({x, y});
  }
  long long int ans = 0;
  for (int i = 0; i < cnt; i++) {
    long long int dis = abs(xs - v[i].first) + abs(ys - v[i].second);
    if (dis > t) continue;
    for (int j = 0; j < cnt; j++) {
      if (dis + abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second) <=
          t) {
        ans = max(ans, (long long int)(abs(j - i) + 1));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
