#include <bits/stdc++.h>
using namespace std;
struct toado {
  long long x, y;
};
toado s0;
toado s;
long long t;
long long ax, bx, ay, by;
vector<toado> a;
long long sum[100];
long long Dist(toado a, toado b) { return abs(a.x - b.x) + abs(a.y - b.y); }
int main() {
  cin >> s0.x >> s0.y >> ax >> ay >> bx >> by;
  cin >> s.x >> s.y >> t;
  long long x = s0.x, y = s0.y;
  for (int i = 1; i <= 60; i++) {
    a.push_back({x, y});
    if (x >= 2e16 || y >= 2e16) break;
    x = ax * x + bx;
    y = ay * y + by;
  }
  for (int i = 1; i < a.size(); i++) {
    sum[i] = sum[i - 1] + abs(a[i].x - a[i - 1].x) + abs(a[i].y - a[i - 1].y);
  }
  int kq = 0;
  for (int i = 0; i < a.size(); i++) {
    for (int j = i; j < a.size(); j++) {
      long long S = 0;
      if (j == 52) int t = 1;
      for (int k = i; k < j; k++) {
        S += Dist(a[k], a[k + 1]);
      }
      for (int k = i; k <= j; k++) {
        long long D = Dist(s, a[k]);
        D += S;
        D += min(Dist(a[i], a[k]), Dist(a[k], a[j]));
        if (D <= t) kq = max(kq, j - i + 1);
      }
    }
  }
  cout << kq;
  return 0;
}
