#include <bits/stdc++.h>
using namespace std;
long long dist(pair<long long, long long> a, pair<long long, long long> b) {
  return (long long)abs(a.first - b.first) +
         (long long)abs(a.second - b.second);
}
int main() {
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  long long x, y, t;
  cin >> x >> y >> t;
  vector<pair<long long, long long>> vc;
  while (1) {
    vc.emplace_back(x0, y0);
    if ((1000000000000000007LL - bx) / ax < x0 ||
        (1000000000000000007LL - by) / ay < y0)
      break;
    x0 = x0 * ax + bx;
    y0 = y0 * ay + by;
  }
  int ans = 0;
  for (auto i = (0); i <= ((int)vc.size() - 1); ++i) {
    for (auto j = (i); j <= ((int)vc.size() - 1); ++j) {
      for (auto k = (0); k <= ((int)vc.size() - 1); ++k) {
        if (dist(make_pair(x, y), vc[k]) +
                min(dist(vc[k], vc[i]) + dist(vc[i], vc[j]),
                    dist(vc[k], vc[j]) + dist(vc[j], vc[i])) <=
            t) {
          ans = max(ans, j - i + 1);
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
