#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long MAX = 2147483647;
long long dis(long long x1, long long y1, long long x2, long long y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
long long dis(pair<long long, long long> a, pair<long long, long long> b) {
  return dis(a.first, a.second, b.first, b.second);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  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> > pt;
  for (int i = 0; i < 60; i++) {
    if (dis(x, y, xs, ys) <= t) pt.emplace_back(make_pair(x, y));
    x = ax * x + bx;
    y = ay * y + by;
    if (x > xs && y > ys && dis(x, y, xs, ys) > t) break;
  }
  int ans = 0;
  for (int i = 0; i < pt.size(); i++) {
    for (int j = 0; j < pt.size(); j++) {
      if (dis(xs, ys, pt[i].first, pt[i].second) + dis(pt[i], pt[j]) <= t)
        ans = max(ans, abs(j - i) + 1);
    }
  }
  cout << ans << "\n";
  return 0;
}
