#include <bits/stdc++.h>
using namespace std;
long long int em(long long int x, long long int Mod, long long int n) {
  if (n == 0)
    return 1ll;
  else if (n % 2 == 0)
    return em((x % Mod * x % Mod) % Mod, Mod, n / 2) % Mod;
  else
    return (x % Mod * em((x % Mod * x % Mod) % Mod, Mod, (n - 1) / 2)) % Mod;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int x0, y0, ax, bx, ay, by, i, j, k, l, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  vector<pair<long long int, long long int> > v;
  while (x0 < 4e16 && y0 < 4e16) {
    v.push_back({x0, y0});
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
  }
  cin >> xs >> ys >> t;
  long long int sz = v.size();
  long long int ans = 0;
  for (long long int i = (long long int)0; i < (long long int)sz; i++) {
    for (long long int j = (long long int)0; j < (long long int)sz; j++) {
      if (abs(xs - v[i].first) + abs(ys - v[i].second) +
              abs(v[j].first - v[i].first) + abs(v[j].second - v[i].second) <=
          t)
        ans = max(ans, abs(j - i) + 1);
    }
  }
  cout << ans;
}
