#include <bits/stdc++.h>
using namespace std;
const long long oo = 1e16;
class Task {
 public:
  void solve() {
    long long x0, y0;
    int ax, ay;
    long long bx, by;
    cin >> x0 >> y0 >> ax >> ay >> bx >> by;
    long long xs, ys, t;
    cin >> xs >> ys >> t;
    vector<pair<long long, long long>> points;
    points.push_back({x0, y0});
    long long x = x0, y = y0;
    while (x * ax + bx <= t + oo && y * ay + by <= t + oo) {
      x = x * ax + bx;
      y = y * ay + by;
      points.push_back({x, y});
    }
    int ans = 0;
    for (int i = 0; i < points.size(); ++i) {
      x = points[i].first;
      y = points[i].second;
      long long cost = abs(x - xs) + abs(y - ys);
      if (t < cost) {
        continue;
      }
      for (int j = 0; j <= i; ++j) {
        for (int k = i; k < points.size(); ++k) {
          long long d1 = abs(x - points[j].first) + abs(y - points[j].second);
          long long d2 = abs(x - points[k].first) + abs(y - points[k].second);
          if (min(d1, d2) + d1 + d2 + cost <= t) {
            ans = max(ans, k - j + 1);
          }
        }
      }
    }
    cout << ans << '\n';
  }
};
int main(int argc, char **argv) {
  Task *task = new Task();
  task->solve();
  return 0;
}
