#include <bits/stdc++.h>
using namespace std;
long long N;
long long n, x, k, z, m, pos, q, ans_v, y, root;
long long a[3][205000], b[200500], w[200500];
pair<long long, long long> f[205];
long long Abs(long long x) { return x > 0 ? x : -x; }
long long dst(long long x, long long y, long long z, long long w) {
  return Abs(x - z) + Abs(y - w);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long pshe = 2LL * (long long)1e+16 + 1;
  long long ax, bx, ay, by, xs, ys, t;
  cin >> f[0].first >> f[0].second >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long sz = 0;
  for (int i = 1; i < 100; i++) {
    f[i].first = f[i - 1].first * ax + bx;
    f[i].second = f[i - 1].second * ay + by;
    if (f[i].first > pshe || f[i].second > pshe) {
      sz = i;
      break;
    }
  }
  long long ans = 0;
  for (int i = 0; i < sz; i++) {
    long long dt = dst(f[i].first, f[i].second, xs, ys);
    long long tt = t;
    tt -= dt;
    if (tt < 0) {
      continue;
    }
    bool fin = false;
    for (int j = i - 1; j >= 0; j--) {
      tt -= dst(f[j + 1].first, f[j + 1].second, f[j].first, f[j].second);
      if (tt < 0) {
        fin = true;
        ans = max(ans, 0LL + (i - j));
        break;
      }
    }
    if (fin) {
      continue;
    }
    if (i == sz - 1) {
      cout << sz << "\n";
      return 0;
    }
    tt -= dst(f[0].first, f[0].second, f[i + 1].first, f[i + 1].second);
    if (tt < 0) {
      ans = max(ans, 0LL + i + 1);
      continue;
    }
    for (int j = i + 1; j + 1 < sz; j++) {
      tt -= dst(f[j + 1].first, f[j + 1].second, f[j].first, f[j].second);
      if (tt < 0) {
        fin = true;
        ans = max(ans, 0LL + j + 1);
        break;
      }
    }
    if (!fin) {
      cout << sz << "\n";
      return 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
