#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, mod = 1e9 + 7, inf = 3e16;
pair<long long, long long> a[N], vs;
long long n = 1, ax, ay, bx, by, t;
long long dis(pair<long long, long long> p1, pair<long long, long long> p2) {
  return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}
long long best(pair<long long, long long> p0, pair<long long, long long> p1,
               pair<long long, long long> p2) {
  return min(dis(p0, p1), dis(p1, p2)) + dis(p0, p1) + dis(p1, p2);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> a[1].first >> a[1].second >> ax >> ay >> bx >> by >> vs.first >>
      vs.second >> t;
  while (a[n].first <= inf && a[n].second <= inf) {
    n++;
    a[n].first = a[n - 1].first * ax + bx;
    a[n].second = a[n - 1].second * ay + by;
  }
  int res = 0;
  for (int i = 1; i <= n; i++)
    for (int l = 1; l <= i; l++)
      for (int r = i; r <= n; r++)
        if (dis(vs, a[i]) + best(a[l], a[i], a[r]) <= t)
          res = max(res, r - l + 1);
  cout << res;
  return 0;
}
