#include <bits/stdc++.h>
using namespace std;
const long long LIMIT = 1ll << 55;
vector<pair<long long, long long> > v;
int main(int argc, char const *argv[]) {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  while (x0 < LIMIT && y0 < LIMIT) {
    v.push_back(make_pair(x0, y0));
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
  }
  int ans = 0;
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    long long tt = abs(xs - v[i].first) + abs(ys - v[i].second);
    if (tt > t) {
      continue;
    }
    for (int j = 0; j < len; ++j) {
      if (t - tt >=
          abs(v[j].first - v[i].first) + abs(v[j].second - v[i].second)) {
        ans = max(ans, abs(i - j) + 1);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
