#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
long long x[maxn + 5], y[maxn + 5];
int n = 1;
long long ax, ay, bx, by, xs, ys, t;
long long caldis(int a, int b) { return abs(x[a] - x[b]) + abs(y[a] - y[b]); }
int solve(int id, long long t) {
  if (t < 0) return 0;
  long long tt = t;
  int now = 1;
  for (int i = id + 1; i <= n; ++i) {
    t -= caldis(i, i - 1);
    if (t < 0) break;
    ++now;
  }
  int ans = now;
  now = 1;
  t = tt;
  for (int i = id - 1; i >= 1; --i) {
    t -= caldis(i, i + 1);
    if (t < 0) break;
    ++now;
  }
  ans = max(ans, now);
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> x[1] >> y[1] >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  for (int i = 2;; ++i) {
    x[i] = ax * x[i - 1] + bx;
    y[i] = ay * y[i - 1] + by;
    if (x[i] - xs + y[i] - ys > t) break;
    ++n;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    ans = max(ans, solve(i, t - abs(x[i] - xs) - abs(y[i] - ys)));
  cout << ans << endl;
  return 0;
}
