#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int test = 1;
  while (test--) {
    long long int xo, yo, ax, ay, bx, by;
    cin >> xo >> yo >> ax >> ay >> bx >> by;
    long long int xs, ys, t;
    cin >> xs >> ys >> t;
    vector<pair<long long int, long long int>> pts;
    vector<long long int> csl, csr;
    while (xo <= xs + t && yo <= ys + t) {
      pts.push_back({xo, yo});
      xo = ax * xo + bx;
      yo = ay * yo + by;
    }
    long long int mx = 0;
    for (long long int i = 0; i < pts.size(); i++) {
      for (long long int j = 0; j < pts.size(); j++) {
        long long int dbp = abs(pts[j].first - pts[i].first) +
                            abs(pts[j].second - pts[i].second);
        long long int m1 = abs(pts[i].first - xs) + abs(pts[i].second - ys);
        long long int m2 = abs(pts[j].first - xs) + abs(pts[j].second - ys);
        if (m1 + dbp <= t || m2 + dbp <= t) {
          if (abs(j - i) + 1 > mx) mx = abs(j - i) + 1;
        }
      }
    }
    cout << mx;
  }
}
